Created
September 17, 2019 15:56
-
-
Save pronichkin/d881373d368c7f01767f3021685bd822 to your computer and use it in GitHub Desktop.
Shows an issue with SwitchParameter in ScriptBlock when execute remotely
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[System.Management.Automation.ScriptBlock]$ScriptBlock = { | |
[cmdletBinding()] | |
Param( | |
[Parameter( | |
Mandatory = $False | |
)] | |
[ValidateNotNullOrEmpty()] | |
[System.Management.Automation.SwitchParameter] | |
# [System.Boolean] | |
$Force | |
) | |
Process | |
{ | |
"Force: $Force" | |
} | |
} | |
Invoke-Command -ScriptBlock $ScriptBlock -ArgumentList $False #-ComputerName 'server.corp.contoso.com' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment