Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Retrieve Azure VM Deallocated Date Using PowerShell



To get the Azure VM deallocated date using PowerShell we can use the below command.

PS C:\> Get-AzVM -VMName Win2k16VM1 -ResourceGroupName TestVMRG -Status

Here it will retrieve the PowerState of the VM.

To retrieve the date when the VM was deallocated, we need to filter out the result.

PS C:\> $vm = Get-AzVM -VMName Win2k16VM1 -ResourceGroupName TestVMRG -
Status

PS C:\> $vm.Statuses[0].Time

Output

Saturday, June 19, 2021 12:49:16 PM
Updated on: 2021-09-02T11:16:56+05:30

1K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements