PowerShell for Windows Admins

January 22, 2011  2:12 PM

Environmental variables

Richard Siddaway Richard Siddaway Profile: Richard Siddaway


Get-WmiObject -Class Win32_Environment | sort Name | select Name, VariableValue

shows the environmental variables that can be seen on the control panel system dialog.

Useful for checking remote machines if the computername parameter is added to Get-WmiObject

January 21, 2011  12:26 PM

First time sighting

Richard Siddaway Richard Siddaway Profile: Richard Siddaway

I received an unsolicited job spec today – first time I’ve seen one with PowerShell listed as the essential skill

Now is definitely the time to start learning PowerShell if you haven’t already

January 19, 2011  2:07 PM

get-scripting PowerShell Podcast

Richard Siddaway Richard Siddaway Profile: Richard Siddaway

I recently recorded an episode of the get-scripting podcast which is produced by fellow PowerShell MVP Jonathan Medd.  The podcast is available from



During the session we discuss:


I enjoyed recording the podcast and hope you will support Jonathan’s efforts by continuing to listen to future episodes

January 18, 2011  3:45 PM

UK User Group–February Live Meeting

Richard Siddaway Richard Siddaway Profile: Richard Siddaway

When: Tuesday, Feb 8, 2011 7:30 PM (GMT)

Where: Live Meeting


An introductory session showing how to get the most out of PowerShell’s utility cmdlets. These are
Suitable for beginners and the odd possible surprise for experts


Richard Siddaway has invited you to attend an online meeting using Live Meeting.
Join the meeting.
Audio Information
Computer Audio
To use computer audio, you need speakers and microphone, or a headset.
First Time Users:
To save time before the meeting, check your system to make sure it is ready to use Microsoft Office Live Meeting.
Unable to join the meeting? Follow these steps:

  1. Copy this address and paste it into your web browser:
  2. Copy and paste the required information:
    Meeting ID: 5D2B4R
    Entry Code: h_>SF*D9q
    Location: https://www.livemeeting.com/cc/usergroups

If you still cannot enter the meeting, contact support

Microsoft Office Live Meeting can be used to record meetings. By participating in this meeting, you agree that your communications may be monitored or recorded at any time during the meeting.

January 16, 2011  1:09 PM

UK PowerShell User Group Meetings

Richard Siddaway Richard Siddaway Profile: Richard Siddaway

Please note the following dates for your diaries:


8 February – PowerShell utility cmdlets

An introductory session showing how to get the most out of PowerShell’s utility cmdlets.  These are



22 March – Regular Expressions

PowerShell MVP Tome Tanasovski will present on Regular Expressions.  This is an opportunity to learn more about an under used part of PowerShell.

Tome is a Windows engineer for a market-leading global financial services firm in New York City. He is a recipient of the PowerShell MVP award, the founder and leader of the New York City PowerShell User group, a blogger, and a regular contributor to Microsoft’s Windows PowerShell forum. He has been featured four times on Hey Scripting Guy, and he is currently working on the PowerShell Bible, which is due out in 2011 from Wiley. 




12 April – PowerShell and COM

PowerShell has great support for WMI and .NET but don’t forget that many applications still only have a COM interface. This session will also cover accessing the Windows Scripting Host functionality. 

All sessions start at 7.30pm UK time unless stated otherwise.  (Note that UK goes to daylight saving time on 20 March)

January 13, 2011  1:57 PM

Registry data types

Richard Siddaway Richard Siddaway Profile: Richard Siddaway


One point I didn’t cover in my series on working with the registry was how to get the type of a registry value.

$regtype = DATA {
ConvertFrom-StringData -StringData 
1 = REG_SZ

$HKLM = 2147483650
$key = "SOFTWARE\Microsoft\Windows\CurrentVersion"
$reg = [wmiclass]"\\$computer\root\default:StdRegprov"
$data = $reg.EnumValues($HKLM, $key)
$x = ($data.snames).Length
for ($i=0; $i -le $x; $i++){"{0,-30} {1}" -f
$data.snames[$i]), $regtype["$($data.types[$i])"] 

The easiest way is to use the EnumValues() method.  This returns integer values for the type.

Define a hash table that contains the integer and its meaning. Define the hive and the key. Create an instance of StdRegProv and invoke the EnumValues method. Loop through the returned values and use a formatted string to display the results

January 13, 2011  12:49 PM

PowerShell and WMI – Chapter 4

Richard Siddaway Richard Siddaway Profile: Richard Siddaway

Chapter 4 has been released for PowerShell and WMI. It is available through the Manning Early Access Program (MEAP) at http://www.manning.com/siddaway2/

The first 4 chapters cover:

  1. Solving Administrative Challenges
  2. Using PowerShell
  3. WMI in Depth
  4. Best Practices

Chapters 5 and 6 covering System Configuration Information and Disk Systems respectively are in the pipeline.  I’m currently working on chapter 7 on the registry. Chapters 5 onwards include lots of lovely scripts.

January 11, 2011  3:12 PM

PowerShell Best practices

Richard Siddaway Richard Siddaway Profile: Richard Siddaway

Ed Wilson – Microsoft Scripting Guy – gave a superb presentation to the UK PowerShell group tonight.  If you missed it the recording will be available for the next 365 days

You have been invited you to view a Microsoft Office Live Meeting recording.
View Recording
Recording Details
    Subject: Windows PowerShell Best Practice
    Recording URL:
    Recording ID: PPS9QQ
    Attendee Key: M5<|wdK;8

I would recommend this to everyone interested in using PowerShell.  You need to listen to the end if you want to find out Ed’s number one, must do, best practice

January 9, 2011  7:40 AM

PowerShell Books

Richard Siddaway Richard Siddaway Profile: Richard Siddaway

There are a lot of PowerShell books on the market. Whether you are just starting  with PowerShell, want to dig further into the subject or need some help with using PowerShell with a particular product it is often helpful to find a book on the subject instead of learning from scratch.

NOTE: This is my own personal view of the books. There are other books available. Some I have looked at and won’t recommend others I have not yet looked at. I am also restricting my list to English language books

These are the books I would recommend. I use many of these on a regular basis.

Title Author Publisher ISBN
Learn Windows PowerShell in a Month of Lunches Don Jones Manning 978161790213
Windows PowerShell Scripting Guide Ed Wilson Microsoft Press 9780735622791
Windows PowerShell Cookbook
First Edition
Second Edition
Lee Holmes O’Reilly
Windows PowerShell 2.0 Best Practices Ed Wilson Microsoft Press 9780735626461
PowerShell in Practice Richard Siddaway Manning 9781935182009
PowerShell and WMI Richard Siddaway Manning 9781617290114
Managing Active Directory with Windows PowerShell Jeffery Hicks Sapien Press 0977659798
Managing VMware Infrastructure with Windows PowerShell Hal Rottenberg Sapien Press 0982131402
PowerShell in Action
First Edition
Second Edition
Bruce Payette Manning  



Learn Windows PowerShell in a Month of Lunches by Don Jones. This is still being written at the time of posting. It is a beginners guide to PowerShell. If you haven’t used PowerShell before this is the place to start.

Windows PowerShell Scripting Guide by Ed Wilson.  This takes over where Don’s book stops. It supplies a good introduction to automating basic windows admin tasks with PowerShell

Windows PowerShell Cookbook by Lee Holmes. Now in its second edition it supplies a lot of scripts for using PowerShell. This book is PowerShell orientated and doesn’t cover using Exchange, AD etc. The techniques are useful for using with some of the more advanced or technology specific books.

Windows PowerShell 2.0 Best Practices by Ed Wilson. Builds on his Scripting Guide and contains good information on designing and testing scripts. Even if you don’t agree with all of the ideas they are worth reading to make you think about how you want to perform these tasks in your organisation.

PowerShell in Practice I wrote as a “PowerShell for Administrators” book. Contains lots of examples for working with AD, WMI, DNS, IIS, Exchange, SQL Server and Hyper-V. I wrote it but I still refer to it for syntax & ideas.

PowerShell and WMI is still being written. WMI is a really powerful technology but the lack of documentation and the difficulty of using it in the past has meant admins have been reluctant to use it. This book is designed to shine a light on to WMI, make it accessible and provide many ready to use scripts

Managing AD with Windows PowerShell by Jeffery Hicks. A second edition is in preparation. This overlaps with PowerShell in Practice to some extent but if you just want to automate AD then start here.

Managing VMware Infrastructure with Windows PowerShell by Hal Rottenberg. If you are using VMware you need this. Admin becomes a lot easier.

PowerShell in Action by Bruce Payette. This is the book for the in depth details on the PowerShell language. If you want to know how and why PowerShell works the way it does this is the book for you. Be aware that it is an advanced text and is NOT recommended for PowerShell newcomers.


This is my view of the PowerShell book world. No doubt other people will have different views. If you think I’ve missed a book that should be one this list please let me know but I will only recommend books I have read.

January 2, 2011  5:23 AM

Seven Habits of Highly Effective PowerShellers

Richard Siddaway Richard Siddaway Profile: Richard Siddaway

Some thoughts on highly effective PowerShell users. They:

  1. Get the job done. This isn’t as obvious as it seems. PowerShell is an automation tool. Use it.  Don’t agonise over the last bit of polishing for your script. Get it into use and gain the benefits. It can always be modified another day. Remember the 80:20 rule.  You’ll get 80% of the benefits with 20% of the effort. 
  2. Don’t forget interactive use of cmdlets. An awful lot of useful work can be performed by using cmdlets. This is especially true if working with Exchange or remote systems (don’t forget WMI)
  3. Use the pipeline. PowerShell is about the pipeline. Use the inbuilt power as much as you can but don’t forget habit 1
  4. Use scripts, functions and modules. This is all about reuse.  Don’t re-write every time.  Modules are great for organising your scripts and loading as required.
  5. Use comments You will see this one in every scripting guide.  You need to be able to understand what you meant to do with the script. This is especially important if you are sharing your scripts
  6. Write PowerShell not VBScript A lot of PowerShell examples are VBScript that has been translated directly into PowerShell. Don’t bring the VBScript habits into PowerShell – but don’t forget habit 1
  7. Are part of the PowerShell community.  By this I mean that they use the PowerShell community to find out how to do things and where possible they contribute back to the community.

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to: