Powershell Simplified Part 1: Basics

You can start the Powershell command line by opening the cmd window and typing ‘powershell’.
Alternately, you can click on the Powershell icon or search for Windows Powershell in the StartMenu.

To check what Powershell version you’re running type $host.


See all the built-in commands Powershell provides: get-command
You can also filter to get a subset of the commands: get-command get-*
To filter by CommandType: get-command –commandtype cmdlet

To get more information on how to use a particular command you can use get-help: get-help get-date
Or simply add a –? at the end of a command: get-eventlog –?

Let’s try out some simple commands at the Powershell command prompt. These should be self explanatory.

start-process notepad

Now let’s try some basic scripting. Create a document called say test.ps1, and copy the three commands into the file. At the Powershell prompt go to the folder which has this file (using the regular cd command – if you notice cd is defined as an alias in Powershell, check using ‘cd –?’). Then type the following at the prompt (note the dot and slash before the file name).

PS C:\> .\test.ps1

You should see the output on the console window and a new notepad instance.


About soumya chattopadhyay
I live and work in Seattle, WA. I work with Microsoft technologies, and I'm especially interested in C#.

3 Responses to Powershell Simplified Part 1: Basics

  1. Pingback: Powershell Simplified Series « I.Net

  2. Pingback: Powershell Simplified Part 2: Arrays and Hashtables « I.Net

  3. Daniel says:

    Thanks for a great blog!

    Just a side note for people having problems running a script:
    Read the following Microsoft TechNet article: http://technet.microsoft.com/en-us/library/ee176949.aspx

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: