MBreidenbach0
Hot Shot
Hot Shot

Export DRS Rules to csv for documentation purposes

I needed something to make DRS rule documentation easier so I did this:

# Export DRS Rules to CSV

# Requires PowerCLI 6.5.1+

# Export DRS Rules

Get-Cluster | Get-DRSRule | select Name,Cluster,Enabled,Type,@{N='VMs';E={[string]::Join(',',((Get-VM -ID $_.VMIDs).Name))}} | Export-CSV -NoType -Delimiter ';' -Encoding Default DRSRule.csv

# Export DRSClusterGroup

Get-Cluster | Get-DRSClusterGroup | Select Name,Cluster,Grouptype,@{N="Member";E={[string]::Join(',',($_.Member))}} | Export-CSV -NoType -Delimiter ';' -Encoding Default DRSClusterGroup.csv

# Export DRSVMHostRule

Get-Cluster | Get-DRSVMHostRule | Select Name,Cluster,VMGroup,Type,VMHostGroup,Enabled | Export-CSV -NoType -Delimiter ';' -Encoding Default DRSVMHostRule.csv

Somebody might find this useful.

0 Replies