Hi Guys
I need a script to get info of vms which are having raw map in the datacenter..
Like this
vm name
cluster name
esxi host ip
disk name..(if it is disk 1 or 2)
datastore name
nna
i used the below script but i am unable to get datastore name,cluster & host info
Get
-VM
| Get
-HardDisk
-DiskType
"RawPhysical"
,
"RawVirtual"
|
Select
Parent,Name,DiskType,ScsiCanonicalName,DeviceName |
fl
Please suggest any modified script to get above information..
Try like this
Get-VM |
Get-HardDisk -DiskType "RawPhysical","RawVirtual" |
Select Parent,Name,DiskType,ScsiCanonicalName,DeviceName,
@{N="Datastore";E={$_.Filename.Split(']')[0].TrimStart('[')}},
@{N="VMHost";E={$_.Parent.Host.Name}},
@{N="Cluster";E={Get-Cluster -VM $_.Parent | Select -ExpandProperty Name}}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Try like this
Get-VM |
Get-HardDisk -DiskType "RawPhysical","RawVirtual" |
Select Parent,Name,DiskType,ScsiCanonicalName,DeviceName,
@{N="Datastore";E={$_.Filename.Split(']')[0].TrimStart('[')}},
@{N="VMHost";E={$_.Parent.Host.Name}},
@{N="Cluster";E={Get-Cluster -VM $_.Parent | Select -ExpandProperty Name}}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
thanks LucD..its worked..
Hi Luc
looking for IP address also..Can you correct the below code.its not writing IP
Get-VM | Get-HardDisk -DiskType "RawPhysical","RawVirtual" |Select @{N="VMName";E={$_.Parent}},
#@{N='IP';E={[string]::Join(',',($_.Guest.IPAddress | Where {($_.Split(".")).length -eq 4}))}},
@{N="IP";E={[string]::Join(',',$_.Guest.IpAddress)|Where {($_.Split(".")).length -eq 4}}},
@{N="HardDisk";E={$_.Name}},
DiskType,
ScsiCanonicalName,
DeviceName,
@{N="Datastore";E={$_.Filename.Split(']')[0].TrimStart('[')}},
@{N="VMHost";E={$_.Parent.Host.Name}},
@{N="Cluster";E={Get-Cluster -VM $_.Parent | Select -ExpandProperty Name}}
Try like this
Get-VM | Get-HardDisk -DiskType "RawPhysical","RawVirtual" |
Select @{N="VMName";E={$_.Parent}},
@{N="IP";E={[string]::Join(',',($_.Parent.Guest.IpAddress|Where {$_.Split(".").length -eq 4}))}},
@{N="HardDisk";E={$_.Name}},
DiskType,
ScsiCanonicalName,
DeviceName,
@{N="Datastore";E={$_.Filename.Split(']')[0].TrimStart('[')}},
@{N="VMHost";E={$_.Parent.Host.Name}},
@{N="Cluster";E={Get-Cluster -VM $_.Parent | Select -ExpandProperty Name}}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks guru that works perfectly.
Hi LucD / Vineeth,
Thanks for this script, As I am looking for this info only.
A small question on this.
If I want to get along with raw map devices, other devices (i.e hard disks not ram mapped) which are mapped to VM. Then how can I get it using the script.
Thanks & Regards
Baburaju.
Try the code given below on my other thread.,In that code you will get complete vm information.
HI Vineeth,
Thanks for the script its working fine for me
With regards
Babu raju.