#Function to configure prefered scope option as Machine function Add-ScopeMachine ($SettingsPath) { if (Test-Path $SettingsPath){ $ConfigFile = Get-Content -Path $SettingsPath | Where-Object {$_ -notmatch '//'} | ConvertFrom-Json } if (!$ConfigFile){ $ConfigFile = @{} } if ($ConfigFile.installBehavior.preferences.scope){ $ConfigFile.installBehavior.preferences.scope = "Machine" } else { Add-Member -InputObject $ConfigFile -MemberType NoteProperty -Name 'installBehavior' -Value $( New-Object PSObject -Property $(@{preferences = $( New-Object PSObject -Property $(@{scope = "Machine"})) }) ) -Force } $ConfigFile | ConvertTo-Json | Out-File $SettingsPath -Encoding utf8 -Force }