Script to export the virtual disk information in a specific format

Hi all

First too all the Scripting Guys who I borrowed the code here, thank you!

Now, I was able to get all the information I want vcenter but I have problems with two of the scripts I wrote.  It is with regard to obtaining information on the virtual disks associated with all virtual machines in the environment.

I was able to export the data, but I get a line by VM that does not work for the way in which we want to use the data.

What I am looking for is a csv export with one line per virtual machine that looks like:

VM number 1, hard disk number 1 name number 1 datastore, path of vmdk number 1 hd, hd number 1 capactity, number 1 hd, hard drive controller number 2 name,... up to 7

name of number 2 VM...

Thank you!

Alec

OK, I see what happened.

The 2nd block is to create empty properties in the object.

The value should be $null like this

$report = @()foreach($vm in Get-VM){  $row = New-Object PSObject -Property @{Name = $vm.Name}  $i = 1  Get-HardDisk -VM $vm | %{    $row | Add-Member -Name "Disk #$($i) Name" -Value $_.Name -MemberType NoteProperty    $row | Add-Member -Name "Disk #$($i)" -Value $_.FileName.Split("/")[1] -MemberType NoteProperty    $row | Add-Member -Name "Disk$($i)path" -Value $_.FileName -MemberType NoteProperty    $row | Add-Member -Name "Disk$($i)Capacity(MB)" -Value ($_.CapacityGB*1024) -MemberType NoteProperty    $row | Add-Member -Name "Disk$($i)Controller" -Value ($_ | Get-ScsiController).Name -MemberType NoteProperty    $row | Add-Member -Name "Disk$($i)Datastore" -Value $_.FileName.Split(']')[0].TrimStart('[') -MemberType NoteProperty    $i++  }  while($i -le 8){    $row | Add-Member -Name "Disk #$($i) Name" -Value $null -MemberType NoteProperty    $row | Add-Member -Name "Disk #$($i)" -Value $null -MemberType NoteProperty    $row | Add-Member -Name "Disk$($i)path" -Value $null -MemberType NoteProperty    $row | Add-Member -Name "Disk$($i)Capacity(MB)" -Value $null -MemberType NoteProperty    $row | Add-Member -Name "Disk$($i)Controller" -Value $null -MemberType NoteProperty    $row | Add-Member -Name "Disk$($i)Datastore" -Value $null -MemberType NoteProperty    $i++  }  $report += $row}

$report  | Export-Csv -path virtual_disks2.csv -notype

Tags: VMware

Similar Questions

  • How to export the virtual machines in the top 10 of the questions?

    Hi all

    I'm looking for a way to script and export the TOP 10 virtual machines that had problems (cpu, memory, disks)

    and if there is a way to export each number to another worksheet or a different line.

    Thanks in advance!

    A slightly different approach, we use the group object to create an object for each virtual computer with the highest CPU usage.

    Of those that we have, then take the 10 with the highest value.

    $cpuWatermak = 90 $vms = Get-VM $metric = "cpu.usage.average" $start = (Get-Date).AddDays(-7)
    
    $stats = Get-Stat -Entity $vms -Stat $metric -Start $start -ErrorAction SilentlyContinue $stats | where {$_.Instance -eq "" -and $_.Value -ge $cpuWatermark} |Select @{N="VM";E={$_.Entity.Name}},Timestamp,Value |Group-Object VM | %{
      $_.Group | Sort-Object -Property Value -Descending | Select -First 1} |
    Sort-Object -Property Value -Descending |Select -First 10
    

    Note that we use only records where the Instance is empty, these are averages aggregated over all hearts.

  • Unable to connect to the virtual disk Service, Virtual Disk Manager Interface not registered

    I installed Windows 7 Ultimate on this laptop as a new installation about six months ago.  Since then, I don't think I ever ran diskmgmt.  Today, I joined a new external hard drive usb, it reported the drivers installed fine, but then the installation bombed at the beginning.  I went to verity, what had happened and has run diskmgmt.msc (as an administrator), but she came back with the message "Unable to connect to the virtual disk Service" and also a small OK msgbox appeared with the title "Virtual Disk Manager" and the "Interface not registered" message

    I disconnected the USB hard drive and tried again diskmgmt, but no change.

    I restarted in safe mode, tried diskmgmt, but no change.

    I ran sfc/scannow, but it has reported that it found no errors.

    I checked that the virtual disk service has been configured as a textbook in services.msc, and event viewer showed that when I ran diskmgmt he started VDS and then stopped VDS.

    I tried again, but still not like before.

    Is there some dll I can't regsrv32?

    Thank you

    Marc

    Hello

    I suggest you to return the items for the following responses from Microsoft, he says same issues with trying the troubleshooting steps and check if it helps.

    http://answers.Microsoft.com/en-us/Windows/Forum/windows_vista-hardware/cant-start-disk-management-unable-to-connect-to/31898500-9d84-4CB5-9ba3-c1f42e3b1ace

    http://answers.Microsoft.com/en-us/Windows/Forum/windows_vista-hardware/problems-with-Vista-after-unplugging-by-external/093f1660-160F-478f-b81a-493e963ffd9a

    http://TechNet.Microsoft.com/en-us/library/cc771775.aspx

    Note: it also applies to Windows 7.

    Hope the information is useful.

  • VMWare Player installation and Installation of the software in the virtual disk

    Hi people,

    I installed VMWare game in the free Version. I want to use the virtual disk for a Windows XP operating system. I have the following question for my main system (8.1 Windows 64 bit system stand-alone system).

    1.

    I installed a Windows XP 64-bit with SP 2 system. In this virtual disk, I installed a software that needs several software components. I managed to install all the components, but one. This component is WindowsInstaller-KB893803-package x 86 lot. If Intry to install the following error notice appears: "Ce KB893803v2 is for a different hardware platform." How can I make this software to obtain the virtual hardware information (i.e. not information of the current build-in components for Windows 8.1).

    2.

    While I did all the settings in Windows XP SP2 in the virtual disk on 'German' keyboard assignment is American. How can I change this?

    3.

    I have a 64-bit Windows 8.1 system on my computer (I think it said 'Host system'). Can I install a Windows XP 32-bit system in the Ramdisk anyway?

    Please answer in detail. I thank in advance for your answers.

    Kind regards. Mainze


    Don't worry too much on the OS host and/or physical hardware like handles of VMware Player, which is required to run Supportepar OSes as guests, for the most part, a layer of virtualized hardware.  Windows XP 32-bit should work fine in VMware Player on your 64-bit Windows 8.1 host.

  • Export the virtual network settings

    I would like to request a feature to be able to export 'Virtual Network Settings' from my computer.

    Whenever I have install or re-install VMWare Workstation on a computer, I have to reconfigure my virtual network settings manually to match the configuration of static IP address I set up on my guest VMs.

    However, if I was able to just export the virtual network settings (and then import these settings into a new installation), I would be able to save time of configuration on each of my computers/workstations and thus avoid manual effort either myself or to inform my colleagues on how to configure their virtual network settings to take in charge the VMS the comments.

    Thank you.

    Run the command with cmd - a started with "run as Administrator"?
    Did you change directory in the installation directory WS first?
    The command runs without any messages.
    The output should be a 8 k file - just tested again on Win7 - 64 running WS 10.0.2

  • script to export the vm

    We have two servers esxi and vcenter with essentials licenses.

    Is there a way to export the virtual machines on a windows share servers every night with a script?

    http://communities.VMware.com/docs/doc-8760

    ghettoVCB

  • VMDKMounter gets error "could not open the virtual disk.

    I have two Win7 x 64 virtual machines running fine with VMware Fusion 4.1.2.  I installed VMDKMounter from VMware 3.1.3 and OSXFuse 2.3.9.  I can ride one of the files hard with VMDKMounter very well, but others told "Cannot open the virtual disk" when I try to mount it.

    8 June 14:43:27 hoth [0 x 0-0xe50e5].com.vmware.vmdkmounter [2394]: could not parse the instant string ' / Users/finchr/Documents/VirtualMachines.localized/hoth.univ.dir.wwu.edu.vmwarevm/hoth.univ.dir.wwu.edu.vmx '. 8 June 14:43:27 hoth [0 x 0-0xe50e5].com.vmware.vmdkmounter [2394]: will not be able to take an informed decision, based on partial information. 8 June 14:43:27 hoth [0 x 0-0xe50e5].com.vmware.vmdkmounter [2394]: mount the drive read-only instead. 8 June 14:43:27 hoth [0 x 0-0xe50e5].com.vmware.vmdkmounter [2394]: failed to open the disc: disc encoding error (261993021117)

    The virtual machine that VMDKMounter fails to mount was created by VMware vCenter Converter 5.0 of a physical machine.  The virtual machine that works was created in VMware Fusion 4.

    Of course, the hard I really want to ride with VMDKMounter is he who fails.  No idea how to make so that he can get?

    Well, I see nothing in the disc DescriptorFile which prevents the hard mounted.

    So right now, you can mount other hard files, but not this one, then I have two suggestions...

    It would be to use vmware-vdiskmanager to create a new hard that will not go up and the other would create a new empty hard, then add it to a virtual machine, as well as one that will not go up and then start with appropriate optical disk or an ISO Image containing the appropriate tools/utilities in order to image the drive to the new empty.  I usually use Symantec Norton Ghost for operations like this.  Then maybe a new mounts with VMDKMounter.

  • Performance of the virtual disks

    Hello!

    Two questions

    1 - it there really a big difference in the performance of the discs thin vs thin discs? one of my friends said slim is slower because he may need more and this growing each time may reduce the speed and performance. is this really?

    2. I get no difference between the discs of updated zero lazy-reset and greedy. that means for the impatient..., are the blocks are written by 0 at the beginning?

    There are a few blocks in the disc ok? then, what is the point to write zero in each of them and then change the exact data we want to be on that block? (maybe there is 1 maybe 0)

    Thank you very much

    So I will use zero - eager to drive thick for my server files (300 users and millions of files) and lazy zero for databases and thin for operating systems and machines at low load of I/O and small changes

    I recommend thick eager-reset to zero especially for databases. It can depend on the workload, however, there are various tutorials for how to configure databases. MS - SQL I usually create virtual discs eager-reset to zero and follow the best spirit of practice of MS formatting NTFS with a 64 KB Cluster size. Where the OS is Windows 2003, don't forget to align the partition! For more information, see Disk Partition alignment Best Practices for SQL Server

    Since, as you have discovered - reset is required will certainly benefit you eager-reset of the virtual disks.

    When you use thin disks, make sure you have the alarms in place to avoid the problems of out-of-space drive!

    André

  • Instant restore: the virtual disk parent has changed since the child has been created

    Buenos dias,

    A worm if someone is ha sown con este problema y me can echar UN cable.

    Al trabajar con una maquina virtual en local con el disco en un disco external depuradora, to me broken instant crear of the United Nations (por el disco local creo en lo disgrace).

    Al use esta Máquina in casa, arranco perfectly, claro, pero sin los datos del snapshot.

    Hoy al arrancarla in the oficina ha generated a conflict: "the virtual disk parent has changed, since the child was creates," ha detectado what ha modified the virtual machine after ultima grabación del snapshot, no permite arrancarla.

    Could eliminando el solucionarlo snapshot, pero no puedo perder todo lo as he ido generating information.

    Alguna idea?

    Para eso estamos DiegoPS.

    No olvides close the discusion marcandola como respondida.

    Saludos,

  • cannot resize the virtual disk (vmdk) after successful hyper-v conversion

    Hello

    We are experiencing an environment vSphere 4.1. I have a problem on the Ramdisk resizing.

    We had managed to convert a hyper v VM. Virtual machine operating system is Windows 2008.

    After that, I can't resize the virtual disk (GB in disk options was gray-ed out, even when the virtual machine is power down)

    It's strange

    I have attached several screenshot of the virtual machine.

    Need your advice.

    Thank you

    His grace is on the IDE interface and you can not resize. the only way is to reclone using vmware converter and resize in the wizard. For more information: http://www.yellow-bricks.com/2010/05/28/resizing-your-ide-virtual-harddisk/

  • Unable to create the virtual disk: fault. RestrictedVersion.summary

    Hello

    Im trying to create a virtual disk using the CLI on ESX4i.  The script is:

    vmkfstools.pl - Server 10.190.2.51 - c 20 g d eagerzeroedthick - a free /vmfs/volumes/Internal/test.vmdk

    When the script runs I get error: unable to create the virtual disk: fault. RestrictedVersion.summary

    Can someone tell me why please.  Im trying to create a disk of 20 GB with adapter free with eagerzeroedthick on my internal called storage, (no subdirectory).

    The file system is THAT VMFS 3.33 maximum file size is 256 GB.  The block size is 1 MB.  If it is the block size that is the problem how can I easily change?

    It's in a laboratory, not a production environment.  I need the flag eagerzeroedthick like Im trying to create a passive active cluster node MSCS 2 on a single physical node with 2 machines VMS.

    Thank you.

    Mike.

    If you use the free version of ESXi (U4 and later versions), access to tools like the VIMA API are read-only.

    -Matt

    VCP, vExpert, Unix Geek

  • Increase the size of the virtual disk.

    I just installed Windows virtual PC on Windows 7 64 bit and I try to install a program of 6 GB.  He said that there is not enough memory.
    The size of the virtual disk in less than 2 GB and I can't find any way to increase this size.  I tried to create a second virtual disk with more memory, but the same error comes back.  Is there a way I can increase the size of the primary virtual disk?

    Post here http://social.answers.microsoft.com/Forums/en-US/w7install/threads or here http://social.answers.microsoft.com/Forums/en-US/w7programs/threads instead.

  • Could not load the virtual disk manager

    I am operating Windows 7 SP1. At one point, I lost the ability to use the virtual disk manager. I've scoured the web and many forums to find answers and none worked. I tried to repair windows, run sfc/scannow, etc stopping before you reinstall windows, which some people have suggested that I have many software loaded and am not sure that this will not happen again once I loaded the software again.

    It is a "backdoor" way to force launch disk management? My need is to change disks on some of the hardware devices, such as DVD players and card readers.

    Would appreciate any advice or suggestions... Thanks in advance.

    Hello

    Thanks for the reply.

    Glad to know that you were able to solve the problem. Your efforts to solve this problem is appreciated. Feel free to post your request here on the Forums of Windows, we would be happy to help you.

    Thank you.

  • When running Disk Management, get the error - failed to connect to the virtual disk Service.

    When I run the Snap on the local server disk management, I get an error message in the status bar: unable to connect to the virtual disk Service.

    Thanks, I have tried these things and nothing has solved the problem.  Here's what I did:

    (a) check the VDS service was manual and failures later per second are 'take no action '.
    ANSWER: Yes to manual and following, second has not changed to "restart the service" of "non-action".
     
    (b) sfc/scannow as administrator
    ANSWER: the System File Checker has found no problem (program reported no problem and findstr/c: "[SR]" on CBS.log doesn't have the list of issues)

    (c) restore to a previous system restore point
    ANSWER: I have tried restore points several more early, each of them failed

  • Copy of the virtual disk for use by another virtual machine

    Hi all! How can I copy a virtual disk file to a location for future use by another virtual machine? I tried to just copy the hard, but it did not work for me - the copy is about 1 KB size and I can not add it as a hard drive on another virtual machine. Can someone help me?

    OK, so this client web vSphere that you use, in this case browse datastore doesn't show you the two files.

    Please follow the steps below

    Please go to Cluster & host inventory

    Select your ESXi host

    go to the tab 'Manage'-> settings-> Security-> Service Profile, and then click the button CHANGE

    Start the SSH service.

    If please use WinSCP to connect to your Esxi host and navigate to the folder of the virtual machine as in the screenshot to the suite, I navigated to a folder that is my VM name: Win10A

    and it has a virtual disk, if I want to take the virtual disk of this virtual machine to a different VM, I need to copy the two files that are highlighted.

    the two are to train your virtual disk.

    Download these two files and download them to another folder where you second VM resides, then try to tie it with this virtual machine.

Maybe you are looking for