Creating a VM report of all our vcenters and one of the columns of data that has proved helpful in our environment is the canonicalname. When space increase request come in, we supply these to the storage team for them to increase the Lun. Then we expand the drive within the OS. Here is what I have and just can't seem to figure out how to do it.
Get-VICredentialStoreItem -File C:\Scripts\PowerCli\credentials-da1.xml | %{Connect-VIServer -Server $_.host -User $_.User -Password $_.Password}
$allhostinfo = @()
$Virtuals = Get-VM | Sort-Object -Property name
Foreach($Virtual in $Virtuals){
$list = Get-view -ViewType VirtualMachine -Filter @{"Name"="$($Virtual.Name)"} -Property name, config, guest, runtime
$allhostinfo += $list}
$Report = @()
Foreach($virtual in $allhostinfo){
$worksheet = [pscustomobject]@{
"VM Name" = $virtual.name
"Guest Host Name" = $virtual.guest.hostname
"Primary IP" = $Virtual.Guest.IPAddress
"Power State" = $virtual.Runtime.PowerState
"CPU #" = $virtual.config.Hardware.NumCPU
"Memory GB" = $virtual.config.Hardware.MemoryMB
"Configured OS" = $virtual.Config.GuestFullName
"Guest OS" = $virtual.Guest.GuestFullName
"Cluster" = (Get-VM -Name $virtual.name | Select-Object -Property Name,@{Name=’Cluster’;Expression={$_.VMHost.Parent}}).Cluster.name
"ScsiCanonicalName" = (Get-View -Id $virtual.Runtime.Host -Property Config.StorageDevice.ScsiLun).Config.StorageDevice.ScsiLun | where ??????
}
$Report += $worksheet
}
Then you could do
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Are these harddisks regualar VMDK ona datastore, and you want the cononicalname of the datastore?
Or are these harddisks RDMs?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I am looking for the LUN ID's on the virtuals which are configured for RDM.
Then you could do
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference