POWERSHELL · AZURE

PowerShell Azure VM Health Check: Detailed Diagnostic Script Guide

Build a repeatable PowerShell Azure VM health check covering VM state, Agent, extensions, disks, NICs, guest health and report generation.

Practical Runbook Technical Troubleshooting
Detailed RunbookCommands + ValidationProduction Troubleshooting
Have a question about this runbook?Post your issue to the TechRunbook Community and get help from other IT professionals.
Ask the Community →

Before you start

Capture the current state, preserve recoverable data and record recent changes before remediation. Use production-impacting commands only within an approved maintenance or change window.

Authenticate and select context

Connect with the approved identity and explicitly select the target subscription. Print the subscription context before collecting evidence.

Check VM state

Collect power state, provisioning state and instance view. Record platform health information returned by Azure.

Check Agent and extensions

Collect Agent status and extension provisioning state. Correlate failed extensions with Agent and guest health.

Inventory disks and network

List OS and data disks, sizes, caching, NICs, private IPs and associated NSGs.

Collect guest diagnostics

Where remote access is available, collect CPU, memory, disk space, services and recent critical events. Export results with timestamp and subscription context.

Azure context

Connect-AzAccount
Get-AzContext

VM status

Get-AzVM -ResourceGroupName 'RG' -Name 'VM' -Status

Guest CPU and memory

Get-CimInstance Win32_Processor | Measure-Object LoadPercentage -Average
Get-CimInstance Win32_OperatingSystem | Select-Object CSName,LastBootUpTime,FreePhysicalMemory

Troubleshooting validation

  • Confirm the original symptom is resolved.
  • Verify dependent services and application health.
  • Review logs or command output for secondary errors.
  • Document the root cause and corrective action.
  • Retain rollback evidence until the change is accepted.

Frequently Asked Questions

What should I check first?

Capture the current state, exact error, affected scope and recent changes before making changes. Then test the failing layer from the lowest dependency upward.

How do I validate the fix?

Repeat the original failing operation, check dependent services and confirm the issue remains resolved after any required restart or service recovery.

Can this troubleshooting be automated?

Automate read-only diagnostics first. Add remediation only after commands, permissions, logging and rollback behavior have been validated.

Related TechRunbook resources

Was this runbook helpful?