PowerShell Parameters, Switch vs Boolean. Is Microsoft breaking PowerShell?

I'm going to have a good look at the New-FSRMFileScreenTemplate cmdlet. There is an issue with the "Active" parameter for this cmdlet. Microsoft specifies in the help information that this is a Switch parameter. Switch parameters by design default to $False

The Active parameter is a switch parameter, but it doesn't have a default value.

clip_image001

According to MSDN, the default value should be false:

clip_image002

The online documentation indicates that if the parameter is not specified, the file screen will be passive.

clip_image003

If you run the New-FSRMFileScreenTemplate cmdlet with the Active switch parameter, you get the desired result:

clip_image004

If you run the New-FSRMFileScreenTemplate cmdlet without the Active switch parameter, the file screen is set to Active, huh?

clip_image005

How do I set the thing to Passive?

Well, trying to set it to $False doesn't work

clip_image006

Treating it like a Boolean Parameter does work though.

clip_image007

Anyone know what Microsoft is up to here? I'm seeing this more and more. Having Switch and Boolean Parameters makes sense, but the documentation MUST be correct, otherwise it really makes the parameters hard to use.

References:

Types of Cmdlet Parameters - https://technet.microsoft.com/en-us/library/dd878252(v=vs.85).aspx

New-FsrmFileScreenTemplate - https://technet.microsoft.com/en-us/library/jj900585(v=wps.630).aspx

Parameter Types in PowerShell - http://blogs.msdn.com/b/candede/archive/2010/01/14/parameter-types-in-powershell.aspx

Popular posts from this blog

Get local computer UUID/GUID using Windows Powershell

gPLink and gPOptions

PSLoggedOn Getting Started on Windows Server 2008 R2