Azure / ArcEnabledServersGroupPolicy

Guidance and sample code to perform at-scale onboarding of servers to Arc via Group Policy
MIT License
9 stars 15 forks source link

Local version detection of installed Azure Arc version not working in Windows 2012 R2 #39

Open laladeadas opened 6 months ago

laladeadas commented 6 months ago

When the script EnableAzureArc.ps1 is checking for the installed version of Azure Arc in windows 2012 it doesn't properly convert from json in the function Get-ArcAgentStatus.

This is the error I get on all windows 2012 R2 that already have Arc installed when the script runs this command "[Version]$LocalAgentVersion = (Get-ArcAgentstatus).Agentversion": "ConvertFrom-Json : Invalid object passed in, ':' or '}' expected. (1): {"

Instead of this "[Version]$LocalAgentVersion = (Get-ArcAgentstatus).Agentversion" a fix I applied is did was these:

[Version]$LocalAgentVersion = (& "$($env:ProgramW6432)\AzureConnectedMachineAgent\azcmagent.exe" --version) -split '(?=\d)',2)[1]