Script to get the disk and LUN informaiton

Hi all

I have the list of virtual machines on servers different vCente and I need to get the disk and LUN information for the list of virtual machines.

Help me build the script?

Kind regards

Vijay

$Information = @)

$Vminfo = get - VM | Select-Object *, @{N = "Hard drives"; E={$_ | Get-HardDisk}}, @{N = "HDDcount"; E={($_ | (Get-harddisk).length}}

$vmlist = $Vminfo | Sort-Object-down HDDcount

{foreach ($vm to $vmlist)

#$Harddiskinfo = $vm | Get-hard drive

$props = new-Object PSObject

$props | Add-member-name "Folder" - Membertype NoteProperty-value $vm.folder

$props | Add-member-name "VMName" - Membertype NoteProperty-value $vm. Name

$props | Add-Member-name "vCPUs" - Membertype NoteProperty-value $vm. NumCpu

$props | Add-member-name "Memory (GB)" - Membertype NoteProperty-value $vm. MemoryGB

$DiskNum = 0

foreach ($hdd in $vm. Hard drives) {}

$controllerinfo = $hdd. ExtensionData

$datastoreName = $($hdd.) Filename.Substring (1) - split ("]" ")) [0]

$datastoreinfo = get-$datastoreName data store

$controllerkey = $controllerinfo.controllerkey.tostring)

$keycount = ($controllerkey |)  measure-object-character | Select-Object - expandproperty Characters) m:System.NET.SocketAddress.ToString)

$virtualID = "{0}: {1}: {2} ' f $controllerkey.substring (0,1), $controllerkey.substring ($keycount - 1), $hdd. ExtensionData.Unitnumber

$props | Add-Member-name "Disk scsiID$ ($DiskNum) '-Membertype NoteProperty-value $virtualID

$props | Add-member-name "$($DiskNum) hard disk drive"-Membertype NoteProperty-value $hdd. Name

$props | Add-member-name "Disk$ ($DiskNum) Size (GB)"-Membertype NoteProperty-value $hdd. CapacityGB

$props | Add-member-name "$($DiskNum) DatastoreName disc"-Membertype NoteProperty-value $datastoreName

$props | Add-member-name "$($DiskNum) DatastoreSize disc"-Membertype NoteProperty-value $datastoreinfo. CapacityGB

$props | Add-member-name "$($DiskNum) DatastoreFreeSpace disc"-Membertype NoteProperty-value $datastoreinfo. FreeSpaceGB

$DiskNum ++

}

$Information += $props

}

$Information | Out-GridView

Tags: VMware

Similar Questions

  • script to get the csv vm disk usage and export to csv format

    Hi all

    I am trying to create a script to get the use of disk for vm - space - free space and total disk space.

    I used this script that allows me to get the required result.

    but I need to edit the script for each cluster, VM he should get computers virtual cluster and check the vm disuage. and export of csv file

    $vms = import-CSV "C:\Cluster.csv".

    $outputfile = "c:\Diskusage.csv".

    SE connect-viserver VC-vcadmin username-password

    {foreach ($vm to $vms)

    Get - VM $vm.name | Where {$_.} PowerState - eq "Receptor"} | Get-VMGuest | Select the ExpandProperty - VMName disks | Select VMName, path, @{Name = "DiskCapacityGB"; Expression = {[math]: Round ((($_.))} {{((Ability) / 1 GB), 2)}}, @{Name = "DiskUsedMB"; Expression = {[math]: Round ((($_.))} Capacity - $_. {{((FreeSpace) / 1 MB), 2)}}, @{Name = "DiskFreeMB"; Expression = {[math]: Round ((($_.))} {{((FreeSpace) / 1 MB), 2)}} | Export-Csv - NoTypeInformation $outputfile}

    Viserver disconnect

    Joint the output file

    Veuileez help me in creating the script

    You can try like this?

    Connect-viserver VC -user vcadmin -password
    foreach($cluster in Get-CLuster){
        $outputfile = "c:\" + $cluster.Name + "-Diskusage.csv"    Get-VM -Location $cluster |
        Where { $_.PowerState -eq "PoweredOn" } |
        Get-VMGuest |
        Select VMName -ExpandProperty Disks |
        Select VMName, Path,
            @{Name="DiskCapacityGB";Expression={[math]::Round((($_.Capacity)/1GB),2)}},
            @{Name="DiskUsedMB";Expression={[math]::Round((($_.Capacity - $_.FreeSpace)/1MB),2)}},
            @{Name="DiskFreeMB";Expression={[math]::Round((($_.FreeSpace)/1MB),2)}} |
        Export-Csv -NoTypeInformation $outputfile}
    
    Disconnect-viserver
    

    The script creates a CSV file for each cluster.

  • I'm new in indesign scripting, please tell me how to write a script to get the contents of an XML element and then sort all the content

    I'm new in indesign scripting, please tell me how to write a script to get the contents of an XML element and then sort all the content

    Hello

    Can the code below is useful for you, but I do not know how to sort.

    Change the tag based on your employment application.

  • need a script to get the news of VMs who believed map

    Hi guys

    I need a script to get the info of VMs who believed the data center map...

    Like this

    name of the virtual machine

    name of the cluster

    ESXi host ip

    name of the disk... (if it is disk 1 or 2)

    name of the data store

    NNA

    I used the script below, but I am unable to store data name, cluster and host Info

    Get-VM| Get-HardDisk-DiskType "RawPhysical","RawVirtual"| SelectParent,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}}
    
  • Failed to get the disk partition information when you add the new data store

    Hello

    Update my ESX to version 4 Update 1 (4.0.0, 256968). Now, I'm trying to add a new data store to a cluster in vCenter and receive the following error message when I will review the current structure of the disc "error when configuring the host: failed to get the disk partition information. When I click back, then next, there's no error message but in the formatting window, I get the error "Object reference" not set to an instance of an object.

    I see this question has been asked before, but I can't seem to find an appropriate response. Anyone? The interface using CLI instead of vCenter isn't an option (alignment VMFS, workload and so on)

    I use Dell R900 with an EMC Symmetrix VMax SAN

    The size of the LUN I want to add is 741 GB

    Concerning

    Marius Aulie

    If you have a virtual machine for Windows test, you could do the following, to ensure that the logic unit number has a clean partition table:

    -set the LUN as a GROSS physical to virtual machine device

    -Run diskpart, select the drive and run the CLEAN command

    -detach the LUN to the virtual machine

    -try to create the data on the LUN VMFS store

    The size of the block of the data store where the VM test can be a problem with the above. Due to the size of the LUN, the size of the block of the data store must be at least 4 MB. Attach the LUN to a physical test system could be an alternative.

    André

  • I was getting a new hard drive to my HP laptop. Since I have a key for Windows Vista from the purchase of the laptop, how can I get the disk to re install the operating system?

    I was getting a new hard drive to my HP laptop. Since I have a key for Windows Vista from the purchase of the laptop, how can I get the disk to re install the operating system?

    original title: reinstall Windows Vista

    I was getting a new hard drive to my HP laptop.  Since I have a key for windows vista from the purchase of the laptop, how can I get the disk to re install the operating system?

    Contact HP (if they had not initially you provided with support or the media manufacturing process or you have lost the media and/or you don't want EU to some tools to clone the old drive to the new or can not do...) for a copy of the media restore/recovery of your system.

    http://www.ZDNet.com/blog/Bott/lost-your-Windows-discs-how-to-get-replacement-media-legally/4320?PG=3

  • The video file can be published to the specified location. Check that the publishing location is still available, that there is enough free space on the disk, and then republish the movie again.

    It happened once before, but it somehow went away after I restarted my laptop. I restarted my laptop, this time, but it has not worked.

    ~*~

    OK, so I just finished put a video together. It consists of a Hypercam 2 record (which means it's a .avi file), a PNG image, text and a song (which is a WMA file).

    ~*~

    I save the file, and then click Publish Movie. Everything goes well until the last step where the video is actually published. The window made a break for a while before you receive the following message;

    ~*~

    "Cannot complete the movie publish .

    The video file cannot be published to the specified location. "Check that the publishing location is still available, that there is enough free space on the disk and then republish the movie again."

    ~*~

    I know there are a lot of free space on the drive on my laptop (it's an Inspiron 1520), and that there is nothing wrong with any of my files. I tried to change places without result. It simply doesn't get it. It would be a great help to me if someone could tell me what is the problem :)

    ~*~

    Thank you very much

    Len

    Microsoft Windows Movie Maker is not to let me publish my movies

    Hello

    I suggest you try the steps mentioned in the link given below.

    Error message when you try to publish a movie using Windows Movie Maker in Windows Vista: "cannot complete publish movie.

    http://support.Microsoft.com/kb/930435

    Additional information:

    Solve problems with publishing a movie to your computer

    http://Windows.Microsoft.com/en-us/Windows-Vista/troubleshoot-problems-with-publishing-a-movie-to-your-computer

  • how re vista windows install so lost the disk and the nly have export key sticker

    Pleading for help.  I bought a computer laptop esprimo Fujitsu three years ago. It came with the disc of instalastion for windows vista home.  I lost the disk and the pc fell and blamed the hard drive and lost all software including my windows original vista, it wouldn't start. one of my friends took for a guy who fixed and installed its own software for windows 7. Then I found when using its true not his and massage keeps poping up that is not authentic. Cannot get their hands on the guy. I can not even media player inst anythalling and even download updates everytime im online cannot be installed and when I followed the link he encourages me to buy a windows 7 for R702 and I only have the money. I was happy with my windows vista. so I got the info under the laptop computer product key it is to say but sctuffy and the serial number, now how do I reinstall my vista from this fake windows 7 oh please someone help please how can I get my rear my own window.

    See the instructions for the reinstallation of Windows Vista:

    http://answers.microsoft.com/en-us/windows/forum/windows_7-windows_install/repair-man-removed-windows-vista-and-installed/f4ec610a-856b-47a6-9ac2-7d5f07763eb0?msgId=343a6389-3a13-46d1-93fa-342f6a9b8ae1

  • continue to be "WindowsUpdate_8024200D" "WindowsUpdate_dt000" I've updated all the disks and still a problem

    continue to be "WindowsUpdate_8024200D" "WindowsUpdate_dt000" I've updated all the disks and still have a problem. have tried all what windows help suggested and still used to install

    Hello

    Thanks for posting in the Microsoft community!

    I understand from the description of the question, that you found WindowsUpdate_8024200D. I'll be happy to help you on this question.

    Please follow the steps mentioned below and get back to us with the results.


    Windows Update error 8024200d
    http://Windows.Microsoft.com/en-in/Windows7/Windows-Update-error-8024200d

    After trying the steps above suggested, giving us the results. If you are unable to solve the problems of Windows Update or display us additional troubleshooting results.

  • I have the CC of the photograph on my desk and I would like to install on my laptop without having to pay for it.  Where can I get the download and how to install it without having to pay for it.

    I photography CC (Lightroom and Photoshop) on my desk, and I would like to install on my laptop without having to pay for it.  Where can I get the download and how to install it without having to pay for it.  Detailed instructions please.  Thank you.

    Cloud license allows 2 activations http://www.adobe.com/legal/licenses-terms.html

    -Install on a 2nd computer http://forums.adobe.com/thread/1452292?tstart=0

    -Windows or Mac has no importance... 2 on the same operating system or 1 on each

    -Two activations on one account CAN NOT be used at the same time (to be noted in the link above of the license)

    -An individual account is for one person and may not be shared with anyone else

    .

    Remove the license on a computer http://forums.adobe.com/thread/1442423?tstart=0 clouds can help

    -read http://helpx.adobe.com/x-productkb/policy-pricing/error-maxium-acitvation-exceeded.html

    -or https://helpx.adobe.com/x-productkb/policy-pricing/activate-deactivate-products.html

    Download & install instructions https://forums.adobe.com/thread/2003339 can help

    -includes a link to access a page to download the Adobe programs if you do not have a disk or drive

    -Cloud desktop http://helpx.adobe.com/creative-cloud/help/creative-cloud-desktop.html

    -Cloud Getting Started https://helpx.adobe.com/creative-cloud.html

    - or kglad links in response to #1 here can help https://forums.adobe.com/thread/2081216

    Also go to https://forums.adobe.com/community/creative_cloud/creative_cloud_faq

  • Can write us "PowerCLI Script" to get the details of card RAID HP (Firmware & Driver)?

    Can write us "PowerCLI Script" to get the details of card RAID HP (Firmware & Driver)

    For example: native ESX command below shows desired output for me.

    But we needed equality PowerCLI ESX command below script

    # cat/proc/driver/cciss/cciss0

    cciss0: HP Smart Array P400i controller

    Board ID: 0x3235103c

    Firmware version: 7.22# cat/proc/driver/hpsa/hpsa0

    hpsa0: HP Smart Array P410i controller

    Board ID: 0x3245103c

    Firmware version: 5,70

    Driver version: HP HPSA driver (v 5.0.0 - 17vmw)

    The extracted following PowerCLI you will get server and type of controller, firmware version and the hpsa/Smart Storage Array controllers driver version based of:

    Get-VMhost | Sort | Select Name, Model,@{N='Controller Type'; E={(Get-VMHostHba -VMHost $_ | ? {$_.Model -imatch '.*(hpsa|smart).*'}).Model}},@{N='Controller Firmware'; E={($_.ExtensionData.Runtime.HealthSystemRuntime.SystemHealthInfo.NumericSensorInfo | ? {$_.Name -like '*hpsa*firmware*'}).Name}},@{N='hpsa Driver Version'; E={($_.ExtensionData.Runtime.HealthSystemRuntime.SystemHealthInfo.NumericSensorInfo | ? {$_.Name -like '*scsi-hpsa*'}).Name}} | Format-Table -Autosize
    

    The sample output:

    
    Name                     Model                Controller Type   Controller Firmware                           hpsa Driver Version----                     -----                ---------------   -------------------                           -------------------esxihost1022.local    ProLiant DL380 G6    Smart Array P410i    HP Smart Array Controller HPSA1 Firmware 6.40    Hewlett-Packard scsi-hpsa 5.0.0.60-1OEM.500.0.0.472560 2014-05-15 15:32:23.000esxihost1023.local    ProLiant DL380 G6    Smart Array P410i    HP Smart Array Controller HPSA1 Firmware 6.40    Hewlett-Packard scsi-hpsa 5.0.0.60-1OEM.500.0.0.472560 2014-05-15 15:32:23.000esxihost1024.local    ProLiant DL380 G6    Smart Array P410i    HP Smart Array Controller HPSA1 Firmware 6.40    Hewlett-Packard scsi-hpsa 5.0.0.60-1OEM.500.0.0.472560 2014-05-15 15:32:23.000esxihost1033.local    ProLiant DL360p Gen8    Smart Array P420i    HP Smart Array Controller HPSA1 Firmware 5.42    Hewlett-Packard scsi-hpsa 5.0.0.60-1OEM.500.0.0.472560 2014-05-15 15:32:23.000esxihost1034.local    ProLiant DL360p Gen8    Smart Array P420i    HP Smart Array Controller HPSA1 Firmware 5.42    Hewlett-Packard scsi-hpsa 5.0.0.60-1OEM.500.0.0.472560 2014-05-15 15:32:23.000esxihost1041.local    ProLiant DL380 G5    Smart Array P400    HP Smart Array Controller HPSA1 Firmware 7.24    VMware scsi-hpsa 5.0.0-17vmw.500.0.0.469512 2011-08-19 01:58:59.000esxihost1042.local    ProLiant DL380 G5    Smart Array P400    HP Smart Array Controller HPSA1 Firmware 7.24    VMware scsi-hpsa 5.0.0-17vmw.500.0.0.469512 2011-08-19 01:58:59.000esxihost1160.local    ProLiant BL460c Gen8    Smart Array P220i    HP Smart Array Controller HPSA1 Firmware 5.22    Hewlett-Packard scsi-hpsa 5.0.0-40OEM.500.0.0.472560 2012-08-24 21:04:51.000esxihost1161.local    ProLiant BL460c Gen8    Smart Array P220i    HP Smart Array Controller HPSA1 Firmware 5.22    Hewlett-Packard scsi-hpsa 5.0.0-40OEM.500.0.0.472560 2012-08-24 21:04:51.000
    
  • Script to change the subnet and vlan.

    Hello

    Please can anyone help with a script to change the subnet and VLANs on all the esx host in a cluster for the vmotion and management network interface?

    Thank you

    Astra

    I guess it worked because you pasted an out front, so:

    Get-Cluster mycluster. Get-VMHost | Get-VMHostNetworkAdapter | where {$_.} PortGroupName - eq "VMotion"} | {} %
    Game-VMHostNetworkAdapter - VirtualNic $_ - IP $_. IP - subnet mask "255.255.254.0" - confirm: $false
    }

    I guess that makes still out:

    Get-Cluster mycluster. Get-VMHost | Get-VMHostNetworkAdapter | where {$_.} PortGroupName - eq "VMotion"}

    2 vmknis right?

    If Yes, then it should work I think.

  • How to get the speed and the influence of the keyframe?

    Hello world

    I'm sorry if my question is due lack of understanding of script in AE but I can't seem to get the speed and influence the properties of selected or closest to the keyframe, I found that the ways to implement.

    Can someone tell me please in the right direction?

    Thank you!

    property.keyInTemporalEase (key) and property.keyOutTemporalEase (key) will give you the objects made easy with speed and influence the attributes for a particular key.

    Dan

  • Get the width and height of the image

    Hi scripters

    I try to get the width and height of my image file. Here is my code

    myPicFile = File("c:\\ar.eps");

    h = myPicFile.height;

    w = myPicFile.width;

    Alert (h)

    Copy the following code generates error

    ---------------------------
    Script alert
    ---------------------------
    undefined
    ---------------------------
    Ok
    ---------------------------

    How can I get the height and the width of my image? is there another method?

    Thanks in advance

    concerning

    a you are the

    Dear Arul,

    Here, my code is in InDesign. I don't know that we get the size of the Image directly. ?

    Throught InDesign [you using the InDesign Script then] Script here I pasted the code below...

    = Image height / width =.

    myDoc var = app.activeDocument;

    myPicFile = file ("E:\\HariharaSudhan\\Blue hills.jpg");

    App.place (file (myPicFile);

    = Then u please select the Image file in InDesign and then you run the script = / /.

    mySel var = app.selection [0];

    var limit = mySel.geometricBounds;

    var height = related [2] - bound [0];
    var width = Bound [3] - bound [1];

    Alert ("Image Height:" + height + ""+"Image width:" + width);

    = End: getting the Image height / width =.

    Please let me know if you have any questions.

    Thank you & best regards

    Thierry T.R.Harihara

  • How do I get the toolbar and the sidebar to display in the Finder?

    How do I get the toolbar and the sidebar to display in the finder window? The choices are grayed out in the view.

    Hello!

    You clicked on dock finder, take the cursor to the top and clicked on display and then click on hide menu bar .it toolbar is hidden.

    See the side bar, tool bar again click on view - once again, click Show toolbar.

    Thank you!

Maybe you are looking for