New Delhi , Moti Nagar
+91-9007641046
subhendu@subhendumct.com

Get a list of all encrypted VMs in your subscription

Live in Future - Live in Cloud

Get a list of all encrypted VMs in your subscription

Within time you will spend time to get a list of virtual machine with and without disk encryption . 

Don’t worry !! Here is the script to get that . If you wanna give thanks to me – you can offer a good cup of coffee to me.

$osVolEncrypted = {(Get-AzureRmVMDiskEncryptionStatus -ResourceGroupName $_.ResourceGroupName -VMName $_.Name).OsVolumeEncrypted}

$dataVolEncrypted= {(Get-AzureRmVMDiskEncryptionStatus -ResourceGroupName $_.ResourceGroupName -VMName $_.Name).DataVolumesEncrypted}

Get-AzureRmVm | Format-Table @{Label="MachineName"; Expression={$_.Name}}, @{Label="OsVolumeEncrypted"; Expression=$osVolEncrypted}, @{Label="DataVolumesEncrypted"; Expression=$dataVolEncrypted}


 

If you want to export this file as CSV use this command :

$osVolEncrypted = {(Get-AzureRmVMDiskEncryptionStatus -ResourceGroupName $_.ResourceGroupName -VMName $_.Name).OsVolumeEncrypted}

$dataVolEncrypted= {(Get-AzureRmVMDiskEncryptionStatus -ResourceGroupName $_.ResourceGroupName -VMName $_.Name).DataVolumesEncrypted}

$king = Get-AzureRmVm | Format-Table @{Label="MachineName"; Expression={$_.Name}}, @{Label="OsVolumeEncrypted"; Expression=$osVolEncrypted}, @{Label="DataVolumesEncrypted"; Expression=$dataVolEncrypted}

$king | export-csv -path C:\desktop\king.csv

Leave a Reply

Your email address will not be published. Required fields are marked *