🚀 Managing Azure VMs just got easier! ☁️
📌 Description I’ve been tinkering with PowerShell again and created a handy script to list all running Azure VMs and let you pick which ones to shut down – no more manual hassle! 💻✨ Whether you want to stop one, a few, or all of them, this script has you covered. 🚀 Features ✅ Lists all running VMs with their resource groups – Get a clear overview in seconds. ✅ Lets you select by number (e.g., "1,3") or type "all" – Flexible and user-friendly. ✅ Handles errors gracefully – Because nobody likes a crash mid-script. 🛠️ Prerequisites 1- PowerShell installed 2- Azure PowerShell module installed 3- Azure subscription PowerShell Script # First, we need to log in to Azure Connect-AzAccount # Get all running VMs $runningVMs = Get-AzVM -Status | Where-Object { $_.PowerState -eq "VM running" } # Check if there are any running VMs if ($null -eq $runningVMs -or $runningVMs.Count -eq 0) { ...