Quantcast
Channel: TechNet Blogs
Viewing all articles
Browse latest Browse all 34890

How to deploy OMS Log Analytics Agent and Dependency Agent to thousands of computers using PowerShell Workflow in parallel

$
0
0

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

}
}


Viewing all articles
Browse latest Browse all 34890

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>