$instances_booted_file_path = "instances_booted.txt" $instance_id = invoke-restmethod http://169.254.169.254/latest/meta-data/instance-id if (!(Test-Path $instances_booted_file_path) -or !(Select-String $instances_booted_file_path -pattern $instance_id)) { (New-Object Net.WebClient).DownloadFile('https://staticdownloads.site24x7.com/server/Site24x7WindowsAgent.msi', 'Site24x7WindowsAgent.msi') msiexec.exe /i Site24x7WindowsAgent.msi EDITA1= ENABLESILENT=YES INSTALLATIONTYPE=AWS_WINDOWS REBOOT=ReallySuppress /qn Add-Content $instances_booted_file_path $instance_id } true