Skip to content

Commit 86b21ec

Browse files
authored
[FEATURE] Use switch instead of boolean in powershell scan script (#505)
If the script is rolled out via GPO and powershell.exe is invoked, arguments such as “$true” are interpreted as a string and therefore rejected. It would be better if we used the switch type. Simply specifying the parameter sets the value to $true ```powershell scan.ps1 : Cannot process argument transformation on parameter 'ForceRegistration'. Cannot convert value "System.String" to type "System.Boolean". Boolean parameters accept only Boolean values and numbers, such as $True, $False, 1 or 0. + CategoryInfo : InvalidData: (:) [scan.ps1], ParentContainsErrorRecordException + FullyQualifiedErrorId : ParameterArgumentTransformationError,scan.ps1 ```
1 parent 7f3a976 commit 86b21ec

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

mdm-scripts/windows/scan.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
Param(
3939
[string] $Product = 'cnspec',
4040
[string] $RegistrationToken = '',
41-
[bool] $ForceRegistration = $false,
41+
[switch] $ForceRegistration = $false,
4242
[string] $Proxy = '',
4343
[string] $ExecutionPath = '',
4444
[string] $DownloadPath = '',

0 commit comments

Comments
 (0)