-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathListAttachedISOs.ps1
23 lines (23 loc) · 1.13 KB
/
ListAttachedISOs.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#######################################################
# Get Iso's attached to VM's in vCenter Report
#######################################################
# Author(s): Mike Ross
# Github: https://github.com/mikewireTX
# Web: https://mikewire.com/
#######################################################
#
# Connect to vCenter
$creds = Get-Credential
# Put your vCenter name here
$server = Read-Host 'Input the vCenter server FQDN or IP'
Connect-VIServer -Server $server -Credential $creds -Force
#########################
#########################
# Get a list of VM's with ISO's attached and list vCenter, Cluster, VM name and ISO
Get-Cluster -PipelineVariable clustername | Get-VMHost | Get-VM | Where-Object {$_.PowerState –eq “PoweredOn”} | Get-CDDrive |
Where-Object {$_.IsoPath -ne $null} | Select-Object -Property @{N='vCenter'; E={([uri]($_.Parent.ExtensionData.Client.ServiceUrl)).Host}}, @{N=’Cluster’;E={$clustername.Name}}, @{N='VM'; E={$_.Parent.Name }}, @{N='ISO'; E={$_.IsoPath}} |
Format-Table
# Disconnect from VIServer
Disconnect-VIServer -Server $server
# End
######################################################