Last active
August 22, 2022 19:16
-
-
Save isjwuk/b4d3647cfafcf3011cd1aac332d2d909 to your computer and use it in GitHub Desktop.
Return a List of Azure VMs not backed up by Recovery Services Vaults
This file contains 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
#Return a List of Azure VMs (in the current context) which are not backed up by Recovery Services Vaults | |
$BackupStatus=@() | |
$BackupStatus=foreach ($VM in Get-AzVM) { $VM | Select-Object Name, ResourceGroupName, @{Name="BackedUp";Expression={(Get-AzRecoveryServicesBackupStatus -Name $VM.Name -ResourceGroupName $VM.ResourceGroupName -Type AzureVM).BackedUp }}} | |
$BackupStatus | Where {$_.BackedUp -eq $false} | Select Name, ResourceGroupName |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment