Automation

 View Only
  • 1.  need a script to get info of vms which are having raw map

    Posted Nov 04, 2013 09:42 AM

    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..



  • 2.  RE: need a script to get info of vms which are having raw map
    Best Answer

    Posted Nov 04, 2013 10:31 AM

    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}}


  • 3.  RE: need a script to get info of vms which are having raw map

    Posted Nov 04, 2013 12:25 PM

    thanks LucD..its worked..



  • 4.  RE: need a script to get info of vms which are having raw map

    Posted Dec 18, 2014 09:15 AM

    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}}



  • 5.  RE: need a script to get info of vms which are having raw map

    Posted Dec 18, 2014 10:40 AM

    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}}  



  • 6.  RE: need a script to get info of vms which are having raw map

    Posted Dec 18, 2014 10:58 AM

    Thanks guru that works perfectly.



  • 7.  RE: need a script to get info of vms which are having raw map

    Posted Oct 31, 2015 12:30 PM

    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.



  • 8.  RE: need a script to get info of vms which are having raw map

    Posted Oct 31, 2015 02:52 PM

    ‌Try the code given below on my other thread.,In that code you will get complete vm information.

    Complete VM information



  • 9.  RE: need a script to get info of vms which are having raw map

    Posted Jan 25, 2016 01:49 PM

    HI Vineeth,

    Thanks for the script its working fine for me

    With regards

    Babu raju.