MSEndpointMgr / ConfigMgr

Microsoft Endpoint Configuration Manager scripts and tools
633 stars 281 forks source link

Invoke-CMDownloadBIOSPackage.ps1 Double quotes in ValidatePattern causes problems with older versions of PowerShell #122

Closed vorlon77 closed 5 years ago

vorlon77 commented 5 years ago

In Invoke-CMDownloadBIOSPackage.ps1 function Invoke-CMDownloadContent uses double quotes in the ValidatePattern clause which causes problems for some versions of PowerShell. Switching to use single quotes allows it to run on a wider variety of PowerShell versions.

Original: function Invoke-CMDownloadContent { param ( [parameter(Mandatory = $true, ParameterSetName = "NoPath", HelpMessage = "Specify a PackageID that will be downloaded.")] [Parameter(ParameterSetName = "CustomPath")] [ValidateNotNullOrEmpty()] [ValidatePattern("^[A-Z0-9]{3}[A-F0-9]{5}$")]

Fixed: function Invoke-CMDownloadContent { param ( [parameter(Mandatory = $true, ParameterSetName = "NoPath", HelpMessage = "Specify a PackageID that will be downloaded.")] [Parameter(ParameterSetName = "CustomPath")] [ValidateNotNullOrEmpty()] [ValidatePattern('^[A-Z0-9]{3}[A-F0-9]{5}$')]

Other than the quote character, it is identical

NickolajA commented 5 years ago

Thank you for the fix, however we don't support older versions of PowerShell like 2.0. I'll make this change anyway though since it doesn't really hurt.