You are all lucky enough to read about my first experiences with PowerShell! For those of you that do not know, PowerShell is a scripting language; which is used for creating temporary fixes and to automate repetitive tasks. I am going to start with the implementation and getting PowerShell working, then onto some basic terminology towards the end of the post.
Getting Up and Running with PowerShell
1. Download Windows Management Framework 3.0 from Microsoft – Download Here
2. You may or may not need to install .NET Framework 2.0, 3.0 or 4.0 depending on your OS
3. I recommend using old DOS commands to familiarise yourself with PowerShell (all old DOS commands still work), otherwise Here are some usefull PowerShell cmdlets.
As in all previous PowerShell versions, Microsoft uses the term Cmdlet (command let); a Cmdlet is a built in PowerShell command, which corresponds to a single verb-noun pair. A Cmdlet is often followed by an alias, if I want to get the mailbox properties for a user on Exchange, I would run the following for example: ‘Get-Mailbox as366498 ’ Note that ‘Get-Mailbox’ is the cmdlet and ‘as366498′ is the alias. If you do not specify an alias, you will get a list of all the mailbox objects.
In order for you to be able to run the PowerShell script above;
- You need to have the correct permissions
- You will need to connect to the mailbox server you are trying to get data from and also authenticate yourself
For pretty much every task you want to complete in your enterprise environment, there is most likely a PowerShell cmdlet which will cater for it!
The Pipeline (|)
Pipelining, was created by Microsoft and could almost be described as PowerShell’s signature tune. Your probably asking yourself ‘what even is a pipeline?’. well, a pipeline is this.. (|) without the brackets either side. PowerShell encourages you to join two statements so that the output of the first clause, becomes the input of the second clause (‘piping the result’ to the second cmdlet).
HELP ME PowerShell !
One of the things i love about PowerShell is that the ‘help’ is clear, concise and full of useful examples. If you dont have many colleagues that are always in the office, and they aren’t always around to help you, you can assure PowerShell is!
All that you need to query the vast help information store, is either put ‘help’ before the cmdlet, for example, help Get-Mailbox; or else append ‘-?’ for example, Get-Mailbox-? (hyphen question mark). The executable powershell.exe even has its own help, try this at the PS prompt, type: powershell -?
Overall, this experience has been somewhat enjoyable and I am happy to say I will be relying on PowerShell throughout my ne career!
Until next time…..