PowerShell for Windows Admins

September 25, 2013  2:10 AM

Server Documentation

Richard Siddaway Richard Siddaway Profile: Richard Siddaway

No one likes documenting their servers but is a necessary job. As the start of a series on taking those first automation steps – you’ve learned PowerShell and now you want to put it to use – I have an article on the Scripting Guy blog that shows you how to get started documenting your servers



If you have any ideas for future articles in the series please leave a comment

September 23, 2013  12:26 PM

Select and List

Richard Siddaway Richard Siddaway Profile: Richard Siddaway

There are many times when I need to do something like this:

get-Whatever | select –first 1 | format-list –property *

Normally its because I need to discover the properties on an object and see some representative data at the same time. If I just wanted the properties I could use Get-Member.

Getting tired of typing

select –first 1 | format-list –property *

Its a bit repetitive & boring I decided to look at a function to do this for me and ended up with this

function Select1FullList {
param (
Invoke-Command -ScriptBlock $scriptblock |
Select-Object -First 1 |
Format-List -Property *

New-Alias -Name sfl -Value Select1FullList

I decided on a scriptblock as input because I wasn’t sure what I’d be wanting to see. For instance

Get-mailbox | Get-mailboxstatistics

could be be my input.

I also decided to use an alias as this is a command line tool for use while I’m writing code. My feelings on aliases in scripts still stand.

Still deciding if I need to add a computername parameter to give it remoting capabilities.

Any ways its going into my profile for now & we’ll see how it works out.

September 21, 2013  5:37 AM

AD Month of Lunches–Chapt 18 & 19 in MEAP

Richard Siddaway Richard Siddaway Profile: Richard Siddaway

An updated MEAP has been released for Active Directory Management in a Month of Lunches. This one adds chapters 18 & 19

Chapter 18, “Managing AD trusts”
Chapter 19, “Troubleshooting your AD”
The MEAP is available from www.manning.com/siddaway3


September 21, 2013  4:23 AM

PowerShell Hero

Richard Siddaway Richard Siddaway Profile: Richard Siddaway

PowerShell.org is giving you the chance to nominate your PowerShell hero – someone how has helped you & others with their PowerShell problems.

Details from http://powershell.org/wp/2013/09/20/nominate-your-powershell-hero/

September 20, 2013  1:51 PM

ErrorAction and WarningAction

Richard Siddaway Richard Siddaway Profile: Richard Siddaway

You’ve all probably done something like this:

£> Get-Process -Name xyz
Get-Process : Cannot find a process with the name “xyz”. Verify the process name and call the cmdlet again.
At line:1 char:1
+ Get-Process -Name xyz
+ ~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (xyz:String) [Get-Process], ProcessCommandException
+ FullyQualifiedErrorId : NoProcessFoundForGivenName,Microsoft.PowerShell.Commands.GetProcessCommand

First though of many people is to do this

Get-Process -Name xyz -ErrorAction silentlycontinue

Now, thats not good as you don’t know that an error has occurred. Its better to deal with it rather than suppress it so you wrap it in a try-catch:

£> try {
>> Get-Process -Name xyz -ErrorAction Stop
>> }
>> catch{
>> “oops”
>> }

In reality you would want to do more than say “oops”

There are a number of situations where cmdlets give you a warning rather than an error. if you want to suppress them use –WarningAction. It has the same options as –ErrorAction

SilentlyContinue. Suppresses the warning message and continues
executing the command.

Continue. Displays the warning message and continues executing
the command. “Continue” is the default value.

Inquire. Displays the warning message and prompts you for
confirmation before continuing execution. This value is rarely

Stop. Displays the warning message and stops executing the

More details in about_Common_Parameters

September 20, 2013  2:39 AM

Using WMI methods with the CIM cmdlets

Richard Siddaway Richard Siddaway Profile: Richard Siddaway

Using WMI class methods with the CIM cmdlets can cause a lot of confusion. This article, of mine, should clear up that confusion for you.


September 20, 2013  1:41 AM

iOS7–1 giant step–backwards

Richard Siddaway Richard Siddaway Profile: Richard Siddaway

Just upgraded my ipad to iOS7 overnight. It looks awful. Like a child’s toy. Apple may have been a triumph of style over substance in the past but they’ve lost any claim to style with this one.

September 18, 2013  1:47 PM

Module versions in PowerShell 4.0

Richard Siddaway Richard Siddaway Profile: Richard Siddaway

Comparing a Windows 8.1 build with a Windows 8 machine I think these modules remain the same between Windows 8/PowerShell 3 and Windows 8.1/PowerShell 4


While these modules appear to have changed – at least with the version number AppBackgroundTask AppLocker Appx AssignedAccess
1.0 Defender
2.0 Dism International Microsoft.PowerShell.Management Microsoft.PowerShell.Utility NetAdapter NetEventPacketCapture NetLbfo NetNat NetQos NetSecurity PcsvDevice
1.1 PrintManagement
1.0 PSDesiredStateConfiguration PSScheduledJob PSWorkflow SecureBoot SmbShare SmbWitness StartScreen Storage TLS TrustedPlatformModule VpnClient WindowsSearch

Some of these are new – look for the 1.0 version numbers. I’ll be working through the changes over the next few weeks. More to come

September 17, 2013  1:04 PM

Death of the command line?

Richard Siddaway Richard Siddaway Profile: Richard Siddaway

I saw this today “the desktop is going to disappear, just like the command line before it” in http://windowsitpro.com/windows-8/windows-desktop-death

Has the guy never heard of PowerShell?

September 16, 2013  11:15 AM

PowerShell Summit NA 2014

Richard Siddaway Richard Siddaway Profile: Richard Siddaway

Public registration for next years PowerShell Summit is now open.


The 2013 summit was the PowerShell event of the year. Next years promises to be at least that good.

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: