Categories: Uncategorized

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
king

Recent Posts

Create Complex NSG – PowerShell

Creating NSG in azure is easy unless you want to create multiple NSG with multiple…

4 years ago

Restore VM from Recovery Service Vault – PowerShell

# Mention your VM here $VMName = "SubhenduTestVM" # Mention your Stage Storage here $stagestorageaccountname…

4 years ago

Power Of Powershell 2

Hope you are doing great . Current Time is very critical for us . I…

4 years ago

Power of Powershell

Being a part of Microsoft Education I have explored powershell long time back . But…

4 years ago

New Azure Exam is Ready to Launch

Sorry !! But Yes .  Microsoft is about to release new exam in Azure Segment…

4 years ago

DFSR to Azure File Sync | DFS cross domain Migration | Azure File Sync Agent issue and Solution

Migration is always a part of our life and part of this fantastic IT world…

4 years ago