Script to get the capacity of HARD disks on a virtual computer

I need to add a line to the script below which will get the additional HARD disks on the virtual machine. At the present time, its just by pulling the primary OS info.

$VmInfo = ForEach ($Datacenter in (Get-Datacenter | Sort-Object -Property Name)) {
  ForEach ($Cluster in ($Datacenter | Get-Cluster | Sort-Object -Property Name)) { 
    ForEach ($VM in ($Cluster | Get-VM | Sort-Object -Property Name)) {
      ForEach ($HardDisk in ($VM | Get-HardDisk | Sort-Object -Property Name)) {
        "" | Select-Object -Property @{N="VM";E={$VM.Name}},
          @{N="Datacenter";E={$Datacenter.name}},
          @{N="Cluster";E={$Cluster.Name}},
          @{N="Hard Disk";E={$HardDisk.Name}},
          @{N="Disk Size MB";E={$HardDisk.CapacityKB/1024}},
          @{N="Datastore";E={$HardDisk.FileName.Split("]")[0].TrimStart("[")}},
          @{N="VMConfigFile";E={$VM.ExtensionData.Config.Files.VmPathName}},
          @{N="VMDKpath";E={$HardDisk.FileName}}
      }
    }
  }
}
$VmInfo | Export-Csv -NoTypeInformation -UseCulture -Path "N:\Excel_Reports\VmInfo.csv"

The RED line is the line that pulls a HARD drive, but I'm looking for enter all HARD DRIVES and the release info... I'm sure it's something simple, but I can't find the command

Just realized that I pasted the script in plain text format, so no formatting was held...

sound this good line

@{N="Disk Size MB";E={$HardDisk.CapacityKB/1024}},

There was a typing error in the code, I've corrected the above code.

Please try again.

Tags: VMware

Similar Questions

  • Increase the size of virtual hard disk to a virtual computer with snapshots

    Is it possible to increase the size of a virtual hard disk on a virtual machine that has snapshots on this subject?  I can use VMware converter to increase the size of the disk, but who commits snapshots during the conversion-

    Thank you

    As everybody said that it is not a good idea to increase the space for a VM with a snapshot.   The snapshot files are all related originally vmdk and when you change this vmdk he breaks the link.

    A particular reason that you cannot commit the snapshot before adding the space.

  • Several same size hard disks on a virtual computer

    Have a VM with several hard disks with the same size to configure.  You want to increase one of the discs, but cannot say that it will increase as sizing in Windows server 2008 disk space does not match what the States of data store?  Is this a unique identifier so I can determine which drive is matched within Windows?

    Thank you

    Windows OS, launch disk management, right-click the disk and examine the properties (specifically, ' location'). Compare that to the SCSI address of the virtual disks on the virtual machine (shown in the "edit parameters" screen inside the vSphere client).

    There is a report more detailed here, if that helps.

  • When I turn on the laptop I get the error SMART hard disk error message

    HP Pavilion DV7 windows 7.

    How can I fix it to this laptop works?

    It is a warning of hard drive.  If the PC does not start, there no more than likely.  I hope that he there backups of data that is valuable, because it may be unavailable now.

    Replace the hard drive and use the Recovery DVD that was made when the PC was new.

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

  • How to check the type of hard disk of the windows operating system?

    on linux, we can find the hdd for example of name setail

    Type a - ide

    SDA - ACHI or sata or sas

    a way to find the type of hard disk in the windows operating system? as linux

    any command or something

    In Windows 7, you can get a lot of details by selecting Start, all programs, accessories, System Tools, system information, components, storage disks. It was very similar to Windows XP, but for all information users tend to use Everest or Belarc Advisor for additional information not available. Everest has been best Bellarc advice but they ceased to offer tan updated free version. However, the 2.20 version is always available from third-party sites.
    http://www.Softpedia.com/get/system/system-info/Everest-Home-Edition.shtml

  • Windows Boot Manager, I want to change the Configuration of hard disk

    I have a computer with two former 500 GB Hard Drives.  The "Legacy" operating system is installed on the first physical hard disk in the system and Windows 7 is installed on the second physical hard disk, they are the identical WD drives.  I bought a new Seagate Barracuda 1000 GB drive, I want to use in place of the mark.

    So currently I have:

    SATA-0, score 0: Legacy 500 GB OS

    SATA-5, score 0: 500 GB Windows 7

    With the new player, I want to:

    SATA-0, score 0: Legacy 500 GB OS

    SATA-0, Partition 1: 500 GB Windows 7

    I have disk imaging software, able to copy both disks to the new partitions on the new disk.  What I want to know is how can ensure me that I continue to get the start menu to see the two operating systems.

    Of course, I will still have the old hard disks available, and I can always put them in.  It's just that the cloning process takes a long time, and I would like to have my procedure in advance.  The first time I have start the system with the 1 TB drive, it will not be a disk of 500 Go SATA-5, score 0: in the computer.  I don't know which files must be modified to search for Windows 7 in the new location.

    I shouldn't need to do a reinstall of windows.  I think I found the answer to what I was looking elsewhere.

    I remember that two years ago, when I set up the Dual boot system, I followed these instructions:

    http://www.SevenForums.com/tutorials/8057-dual-boot-installation-Windows-7-XP.html

    When I did, I had a dual boot menu:

    -Old Version of Windows

    -Windows 7 Professional

    Of course I meant "Windows XP" rather than "earlier Version of Windows.  I searched and found that a tool exists to modify this menu.  I don't remember what they called the tool when I presented this request.  I was pretty sure that the tool would allow me to have the change of start menu where he sought the installation of Windows7.

    Today, I found the name of the tool, it is called BCDEDIT. EXE.  It allows you to safely edit the menu file, and startup locations resemble the old file boot.ini of Windows NT days.  Here's what the tool then generates on the command line.

    Windows Boot Manager
    --------------------
    identifier {bootmgr}
    Device partition = D:
    Description Windows Boot Manager
    settings regional en-US
    inherit {globalsettings}
    default {current}
    RESUMEOBJECT {a68ca6ef-27a1-11e3-bc5b-844b6ef301be}
    displayorder {ntldr}
    {current}
    toolsdisplayorder {memdiag}
    timeout 8 / / used to be '30'

    Windows Legacy operating system loader
    ------------------------
    identifier {ntldr}
    Device partition = D:
    path \ntldr
    Description Windows XP / / used to be "Earlier Version of Windows"

    Windows boot loader
    -------------------
    identifier {current}
    Device partition = C:
    path \Windows\system32\winload.exe
    Description of Windows 7
    settings regional en-US
    inherit {bootloadersettings}
    recoverysequence {a68ca6f1-27a1-11e3-bc5b-844b6ef301be}
    recoveryenabled Yes
    OSDEVICE partition = C:
    SystemRoot \Windows
    RESUMEOBJECT {a68ca6ef-27a1-11e3-bc5b-844b6ef301be}
    NX OptIn

    I have foound good information about this tool on:

    http://www.nextofwindows.com/

  • 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}}
    
  • Cannot access the PX1396E external HARD disk

    Just bought this external hard drive 1 TB.
    I Plug and Windows (xp) it detects and installs the drivers, or something.

    When I click on it for the Explorer, it says please insert disk into drive X.
    I plugged on 3 computers in different and same problem.

    I tried looking for specific drivers, but it doesn't seem to be any, not even in the toshiba Web site.
    What's up, anyone know?

    Thank you.

    Hello!

    > but is not recognized PPP
    Can you please explain this? It is unclear to me.

    But if the disc external HARD only on a laptop computer does not contact the other laptop manufacturing. Maybe the chipset driver needs to be updated or it s mainboard issue.

    As floh_1 said, you can try another cable. It s worth a try! ;)

    Good bye

  • I have home premium Windows 7 with activation key. I replaced everything at the time of hard disk. I'm not able to activate Home premium Windows 7 please guide me

    I have home premium Windows 7 with activation key. I replaced everything at the time of hard disk. I am not able to install or upgrade Home premium Windows 7

    Have you tried to restart by phone?

    How to activate Windows 7 manually (activate by phone)
     
    1) click Start and in the search for box type: slui.exe 4
     
    (2) press the ENTER"" key.
     
    (3) select your "country" in the list.
     
    (4) choose the option "activate phone".
     
    (5) stay on the phone (do not select/press all options) and wait for a person to help you with the activation.
     
    (6) explain your problem clearly to the support person.
     
    http://support.Microsoft.com/kb/950929/en-us

  • Using the service 'Release hard disk': some pictures of stay in "Update the Photos to reissue", even if I publish it

    Hello

    First of all please excuse my bad English. [I am french :-)]

    I have 2 different problems with pictures in smart albums used in a service of "Publish on hard drive" [Publication of the Service of hard disk] :

    -some of them stay in the section "Updating the Photos to republish" ['Changed to republish photos'] even when I publish it. The published photo is created and saved on my hard drive, but the picture goes to the section "Published photos" [published Photos by] for a second and then go back to the section "update the Photos to republish. To move back then in 'Published Photo', I need to use the "mark as up to date" [mark as updated] option in the right click menu.

    d ' other hand, some ot them (maybe the same) are still stuck in the section 'photos Publised' even if I do some changes (adding keyword, change some options of development...).

    Can I have some help please?

    Fabien.

    I had the same problem and I found the solution here: Lightroom CC 2015, error Publishing Services

    -Terje

  • 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 get the name of VMhost among a list of VM?

    Hi people,

    Can anyone here help me scripting by getting the ESXi host name or $vmhost name in the list of the VM?

    Thank you.

    You mean this

    Get-VM | Select Name,@{N="Host";E={$_.Host.Name}}
    
  • 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.

  • Run a virtual hard disk file in Virtual PC

    Hello

    I recently got a Windows 7 PC to replace a Windows XP machine. However, while I still have access to anything whatsoever on the old PC that I maybe need even once, I did a .vhd on the old hard drive file.

    I can't open this vhd file, because I can't find a way to create a new virtual PC with which use this virtual hard disk.

    Is anyway to do this?

    Thank you
    Richard

    Windows 7 can read files in VHD(Virtual Hard Disk) without VPC (Virtual PC).  You can make the VHD file be seen as a hard drive on the new PC. Here's how to do it.

    Attach the VHD file:
    1. right click on 'My Computer' and click on 'manage '.
    2. go in "Disk management" under "Storage" on the left side.
    3. click on the 'Action' menu on the top and click on "attach VHD.
    4 locate the hard drive file virtual you want to open, you can also make the drive read only just in case you accidentally change something.  Then click on 'OK '.
    5. you should see your virtual hard drive in "My Computer"
    Detach the VHD file:
    1. go in disk management as described in steps 1 and 2 as I explained earlier.
    2. on the bottom half of the window, find the hard drive virtual you want to detach.
    3 click on the "disk #" and click on "remove VHD.
    Good luck. God bless you. :)

Maybe you are looking for