35. PowerShell.exe Command-Line


The below information is extensively based in information taken from the PowerShell® Notes for Professionals book. I plan to extend this information based on my day to day usage of the language.

Parameter Description
-Help -?
-File [] Path to script-file that should be executed and arguments (optional)
-Command { - / [-args ] / [] } Commands to be executed followed by arguments
-EncodedCommand Base64 encoded commands
-ExecutionPolicy Sets the execution policy for this process only
-InputFormat { Text XML}
--Mta PowerShell 3.0+: Runs PowerShell in multi-threaded apartment (STA is default)
--Sta PowerShell 2.0: Runs PowerShell in a single-threaded apartment (MTA is default)
-NoExit Leaves PowerShell console running after executing the script/command
-NoLogo Hides copyright-banner at launch
-NonInteractive Hides console from user
-NoProfile Avoid loading of PowerShell profiles for machine or user
-OutputFormat { Text / XML } Sets output format for data returned from PowerShell. Text (strings) or XML (serialized CLIXML)
-PSConsoleFile Loads a pre-created console file that configures the environment (created using Export-Console )
-Version Specify a version of PowerShell to run. Mostly used with 2.0