Contact Info

Crumbtrail » Administration » Powershell » Powershell 1.0 » Powershell

Powershell - Powershell 1.0 CmdLet

Microsoft Windows PowerShell is a command-line shell and scripting tool based on the Microsoft .NET Framework. It is designed for system administrators, engineers and developers to control and automate the administration of Windows and applications.

More than hundred command-line tools (so called "cmdlets") can be used to perform system administration tasks and Windows Management Instrumentation (WMI). These cmdlets are easy to use, with standard naming conventions and common parameters, and standard tools for piping, sorting, filtering, and formatting data and objects.


Launch a powershell session


-PSConsole File   Load a PowerShell console file. (created with export-console)

   -Version          Start the specified version of Windows PowerShell.

   -NoLog            Hide the copyright banner at startup.

   -NoExit           Do not exit after running startup commands.

   -NoProfile        Do not use the user profile.

   -Noninteractive   Don't present an interactive prompt to the user.

   -OutputFormat     Format the output. Valid values are "Text" (string)
                     or "XML" (serialized CLIXML format).

   -InputFormat      Format of data sent to Windows PowerShell. Valid values are
                     "Text" (string) or "XML" (serialized CLIXML format).  

   -Command          Execute commands or a script file of commands 
                     If Command is "-", the command text is read from standard input.

   -Help, -?, /?     Display Help

PowerShell.exe -PSConsoleFile "C:\scripting\MyShell.psc1" -Command ". 'MyScript.ps1'"

Display the security event log:

powershell -command {get-eventlog -logname security}

Or the same thing but calling powershell from the CMD shell:

powershell -command "& {get-eventlog -logname security}"