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.
According to MSDN, the default value should be false:
The online documentation indicates that if the parameter is not specified, the file screen will be passive.
If you run the New-FSRMFileScreenTemplate cmdlet with the Active switch parameter, you get the desired result:
If you run the New-FSRMFileScreenTemplate cmdlet without the Active switch parameter, the file screen is set to Active, huh?
How do I set the thing to Passive?
Well, trying to set it to $False doesn't work
Treating it like a Boolean Parameter does work though.
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