I used this when trying to delete old ISO images from a datastore. The file would not delete as it was still attached to a VM.
Get-VM | where { $_ | Get-CDDrive | where { $_.ConnectionState.Connected -eq "true" -and $_.ISOPath -like "*.ISO*"} } | select Name, @{Name=".ISO Path";Expression={(Get-CDDrive $_).isopath }}
No comments:
Post a Comment