Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jaycdave88/d77fb3411d7e7429ca1b465c12ae5bbe to your computer and use it in GitHub Desktop.
Save jaycdave88/d77fb3411d7e7429ca1b465c12ae5bbe to your computer and use it in GitHub Desktop.
$pwd = convertto-securestring "Admin!" -asplaintext -force
$cred=new-object -typename System.Management.Automation.PSCredential -argumentlist ".\reutadmin",$pwd
$windows_vms = @("192.168.86.66")
$install_datadog = {
& msiexec /qn /i datadog-agent-6-latest.amd64.msi APIKEY="DATADOG_API_KEY" HOSTNAME="my_hostname" TAGS="mytag1,mytag2"
}
Invoke-Command -ComputerName $windows_vms -ScriptBlock $install_datadog -AsJob -Credential $cred
Wait-Job *
Receive-Job *
Remove-Job *
@DD-ScottBeamish
Copy link

Pre-steps:

  • Make sure all Client VMs have Remote PowerShell set up
  • Add the ip or hostname of the VM to line 5 - you can also add multiple env or ip(s)just make it a hash for env or for more ip(s) just comma seperated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment