workflow installOMS{
$computers = inlinescript
{
$BaselineFile = “$env:tempcomputers.txt”
$lines = (Get-Content $BaselineFile)
$computers = foreach ($line in $lines) { $line.Trim()}
return $computers
}
parallel
{
inlinescript
{
try
{
$OPSINSIGHTS_WS_ID = “??????”
$OPSINSIGHTS_WS_KEY = “?????”
$arg1 = ‘/C:”setup.exe /qn ADD_OPINSIGHTS_WORKSPACE=1 ‘+ “OPINSIGHTS_WORKSPACE_ID=$OPSINSIGHTS_WS_ID ” + “OPINSIGHTS_WORKSPACE_KEY=$OPSINSIGHTS_WS_KEY ” +’AcceptEndUserLicenseAgreement=1″‘
write-output $env:computername
$myoutfile1 = “$env:tempMMASetup-AMD64.exe”
Invoke-WebRequest “https://go.microsoft.com/fwlink/?LinkId=828603” -OutFile $myoutfile1
Start-Process -FilePath $myoutfile1 -ArgumentList $arg1 -Wait
$arg2 = “/S”
$myoutfile2 = “$env:tempInstallDependencyAgent-Windows.exe”
Invoke-WebRequest “https://aka.ms/dependencyagentwindows” -OutFile $myoutfile2
Start-Process -FilePath $myoutfile2 -ArgumentList $arg2 -Wait
}
catch
{
Write-Error -Message $_.Exception
throw $_.Exception
}
} -PSComputerName $computers
}
}