PSParallel.InvokeParallelCommand.GetVariables C# (CSharp) Method

GetVariables() private static method

private static GetVariables ( System.Management.Automation.SessionState sessionState ) : IEnumerable
sessionState System.Management.Automation.SessionState
return IEnumerable
		private static IEnumerable<PSVariable> GetVariables(SessionState sessionState)
		{
			try
			{
				string[] noTouchVariables = { "null", "true", "false", "Error" };
				var variables = sessionState.InvokeProvider.Item.Get("Variable:");				
				var psVariables = (IEnumerable<PSVariable>)variables[0].BaseObject;
				
				return psVariables.Where(p => !noTouchVariables.Contains(p.Name));
			}
			catch (DriveNotFoundException)
			{
				return new PSVariable[] { };
			}
		}