So, I consider myself a pretty good PowerShell user/scripter. But, I was stumped by a small issue with trying to use the "Remove-ActiveSyncDevice" cmdlet in Exchange 2010 to not prompt for each device removal.
Our (Microsoft) TechNet article on using Remove-ActiveSync Device (http://technet.microsoft.com/en-us/library/bb125032(v=exchg.141).aspx) did not provide a lot of help. It tells you there's the "-Confirm" parameter and that it will cause you to be prompted, but does not say how to get it to NOT prompt.
If you try "-Confirm $false", you'll get the following error back:
A positional parameter cannot be found that accepts argument 'False'.
+ CategoryInfo : InvalidArgument: (:) [Remove-ActiveSyncDevice], ParameterBindingException
+ FullyQualifiedErrorId : PositionalParameterNotFound,Remove-ActiveSyncDevice
This method: DiRECTIVE + SPACE + VALUE is a normal way of running commands and providing values. But, for the "-Confirm" directive and the Remove-ActiveSyncDevice cmdlet (I suspect this is true with most Exchange cmdlets) you CANNOT use that method. You MUST use DIRECTIVE + COLON + VALUE: -Confirm:$false
With that, it will NOT prompt.
I'm sure there's lots of folks out there that already knew this...especially if you normally use the method with colons, you probably didn't even realize this was an issue. For the rest of us, this is one of those things where what should/would normally work with other directives (using a space) does not work with -Confirm.