Created
May 20, 2025 10:28
-
-
Save AlexanderHolmeset/377dac36ca618899115f204ef830f17a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This script will get all VMs with the guest OS "Windows Server" and send the details to a webhook URL in JSON format. | |
$VMs = get-vm | Where-Object{$_.guest -match "Windows Server"} |Select-Object -Property Name,Guest,CreateDate | |
# Convert the VM details to JSON format | |
$body = $VMs | ConvertTo-Json | |
$webhookURI = "Enter your webhook URL here" | |
# Send the JSON data to the webhook URL for the Azure Automation runbook | |
Invoke-WebRequest -Method Post -Uri $webhookURI -Body $body -UseBasicParsing |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment