Skip to content

Instantly share code, notes, and snippets.

@sandeepkv93
Created May 7, 2020 05:04
Show Gist options
  • Save sandeepkv93/002f3bde5beb0d346c1a1405f5bea81b to your computer and use it in GitHub Desktop.
Save sandeepkv93/002f3bde5beb0d346c1a1405f5bea81b to your computer and use it in GitHub Desktop.
Windows Powershell script for InVM Notification using Azure Metadata Service
# 1. RDP into the VM
# 2. Open PowerShell in Administrator Mode.
# 3. Run the command ‘Set-ExecutionPolicy Unrestricted’.
# 4. Create a powershell script called ‘windows-invm-notification.ps1’ and copy the following content in the file.
DO
{
Invoke-WebRequest http://169.254.169.254/metadata/scheduledevents?api-version=2019-01-01 -H @{"Metadata"="true"};
Start-sleep -Seconds 2;
} While ($true)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment