* Rework verify agent OS step. * Address feedback * Justing string matching instead. * ! instead of -not Co-authored-by: Mitch Denny <midenn@microsoft.com>
13 lines
573 B
PowerShell
13 lines
573 B
PowerShell
param (
|
|
[Parameter(Mandatory = $true)]
|
|
[ValidateNotNullOrEmpty()]
|
|
[string] $AgentImage
|
|
)
|
|
|
|
function Throw-InvalidOperatingSystem {
|
|
throw "Invalid operating system detected. Operating system was: $([System.Runtime.InteropServices.RuntimeInformation]::OSDescription), expected image was: $AgentImage"
|
|
}
|
|
|
|
if ($AgentImage -match "windows|win|MMS2019" -and !$IsWindows) { Throw-InvalidOperatingSystem }
|
|
if ($AgentImage -match "ubuntu" -and !$IsLinux) { Throw-InvalidOperatingSystem }
|
|
if ($AgentImage -match "macos" -and !$IsMacOs) { Throw-InvalidOperatingSystem } |