VMware Cloud Community
jessem
Enthusiast
Enthusiast

What VMs are SRM protected

I tried searching and was confused by some of the search results.  I thought I would re-ask again.  Is there a script that can output to a .csv file that lists what VMs are protected by SRM?

4 Replies
LucD
Leadership
Leadership

Reply
0 Kudos
jessem
Enthusiast
Enthusiast

I tried looking at that earlier, and I am having a difficult time understanding it.  If I put that in a .ps1 script, do I have to change any fields?  Where do I run this on?


Also, I saw this out there and wondered if that will work too?  Only problem is I know to run it on the recovery side, but need to output to clean .csv.

Get-VM |
where  { @($_.Harddisks | Select -ExpandProperty Name) -contains "Placeholder"} |
Select
Name

Reply
0 Kudos
LucD
Leadership
Leadership

No, you don't have to change any fields, just provide the parameters to the call.

The way to call the script is in the comments on the Usage line.

That 2nd script will work as well, it uses the fact that SRM will give the harddisks of the VMs that are protected a specific name (containing "Placeholder").

To get the result in a CSV, just pipe the result to the Export-Csv cmdlet.

Get-VM |
where  { @($_.Harddisks | Select -ExpandProperty Name) -contains "Placeholder"} |
Select
Name | Export-Csv report.csv -NoTypeInformation -UseCulture


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
jessem
Enthusiast
Enthusiast

Ok no luck.  I ran the script and the c:\report.csv file is empty.  I did run it on the recovery site vCenter.  Next steps?