<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Weird issues on VM HardDisk information Script in VMware PowerCLI Discussions</title>
    <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Weird-issues-on-VM-HardDisk-information-Script/m-p/2706888#M93754</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;these are all vcenters, multiple versions (4.1, 5.0 and 5.1)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;its really odd that i can use Get-VM on the same server that it claimed disconnection with no errors, something like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) Connected to 3 vCenters: vc01, vc02 and vc03&lt;/P&gt;&lt;P&gt;2) Run script and i get the error 'vc01 is not connected'&lt;/P&gt;&lt;P&gt;3) Get-VM vm01 (which happens to be at 'vc01', that just disconnected) and it retrieves it normally&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;edit:&lt;/P&gt;&lt;P&gt;ran the command with the modifications to troubleshoot disconnection like you said, and no disconnections at all ! All the 15 vCenters still connected while running the command&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The exception is below&lt;/P&gt;&lt;P&gt;Get-VIObjectByVIView : 25/09/2013 11:25:27&amp;nbsp;&amp;nbsp;&amp;nbsp; Get-VIObjectByVIView&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Server XXXXX is not connected.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 25 Sep 2013 14:24:32 GMT</pubDate>
    <dc:creator>rtunisi</dc:creator>
    <dc:date>2013-09-25T14:24:32Z</dc:date>
    <item>
      <title>Weird issues on VM HardDisk information Script</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Weird-issues-on-VM-HardDisk-information-Script/m-p/2706886#M93752</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hello everyone&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i am designing some simple script to retrieve VM Hard Disk information with PowerCli and i got some pretty weird issue: i ocasionally get runtime execution errors with vc server disconnection, &lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;but after the error, i can retrieve info on the same vcenter with simple commands (like Get-VM for instance). The vc farms still available over viclient and powercli all the time, so it must be something on the code&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;the steps i use to reproduce the strange behavior:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(Using Powercli 5.5 and Powershell 3.0. Error still happens with Powercli 5.1)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Connect to vcenter (multiple servers)&lt;/P&gt;&lt;P&gt;- run the command and it eventually gets stuck in line 12 ($ghd = Get-HardDisk (Get-VIObjectByVIView $VMView)) with the error 'Server XXXX is disconnected'&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;- Run some other command (like get-vm) to certify that server is still connected&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;sample script is below&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_13801169372439008" jivemacro_uid="_13801169372439008" modifiedtitle="true"&gt;
&lt;P&gt;Function Get-VMDiskInfo {&lt;/P&gt;
&lt;P&gt;&amp;nbsp; [CmdletBinding()]&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Param (&lt;/P&gt;
&lt;P&gt;&amp;nbsp; [Parameter(Mandatory=$true,&lt;/P&gt;
&lt;P&gt;&amp;nbsp; ValueFromPipeline=$True,&lt;/P&gt;
&lt;P&gt;&amp;nbsp; ValueFromPipelineByPropertyName=$true)]&lt;/P&gt;
&lt;P&gt;&amp;nbsp; [Alias('Name')]&lt;/P&gt;
&lt;P&gt;&amp;nbsp; $VM&lt;/P&gt;
&lt;P&gt;&amp;nbsp; )&lt;/P&gt;
&lt;P&gt;&amp;nbsp; PROCESS{&lt;/P&gt;
&lt;P&gt;&amp;nbsp; $VMView = Get-View -ViewType VirtualMachine -Filter @{"Name" = $VM}&lt;/P&gt;
&lt;P&gt;&amp;nbsp; $ghd = Get-HardDisk (Get-VIObjectByVIView $VMView)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $output = @()&lt;/P&gt;
&lt;P&gt;&amp;nbsp; ForEach ($VirtualSCSIController in ($VMView.Config.Hardware.Device | Where {$_.DeviceInfo.Label -match “SCSI Controller”})){&lt;/P&gt;
&lt;P&gt;&amp;nbsp; ForEach ($VirtualDiskDevice in ($VMView.Config.Hardware.Device | Where {$_.ControllerKey -eq $VirtualSCSIController.Key})){&lt;/P&gt;
&lt;P&gt;&amp;nbsp; $VMSummary = “” | Select&amp;nbsp; VM,Disk, SCSI, DiskType, DiskFormat, DiskSizeGB, DiskFile&lt;/P&gt;
&lt;P&gt;&amp;nbsp; $VMSummary.VM = $VM&lt;/P&gt;
&lt;P&gt;&amp;nbsp; $VMSummary.SCSI = [string]::Concat($VirtualSCSIController.BusNumber,":",$VirtualDiskDevice.UnitNumber)&lt;/P&gt;
&lt;P&gt;&amp;nbsp; $VMSummary.Disk = $VirtualDiskDevice.DeviceInfo.Label&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; #pegando info do Get-Harddisks&lt;/P&gt;
&lt;P&gt;&amp;nbsp; $d = $ghd | ? {$_.Name -match $VirtualDiskDevice.DeviceInfo.Label}&lt;/P&gt;
&lt;P&gt;&amp;nbsp; $VMSummary.DiskType = $d.DiskType&lt;/P&gt;
&lt;P&gt;&amp;nbsp; $VMSummary.DiskSizeGB = [Math]::Round($d.capacityGB,2)&lt;/P&gt;
&lt;P&gt;&amp;nbsp; $VMSummary.DiskFile = $d.filename&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; if($d.Disktype -eq "Flat"){&lt;/P&gt;
&lt;P&gt;&amp;nbsp; $VMSummary.DiskFormat = $d.StorageFormat&lt;/P&gt;
&lt;P&gt;&amp;nbsp; }&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&amp;nbsp; $output += $VMSummary&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;
&lt;P&gt;&amp;nbsp; }&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Write-Output $output&lt;/P&gt;
&lt;P&gt;&amp;nbsp; }&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;does anyone have any idea whats going on ? &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;almost forgot, sorry about the messy code and the poor english...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;thanks in advance&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Sep 2013 14:02:37 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Weird-issues-on-VM-HardDisk-information-Script/m-p/2706886#M93752</guid>
      <dc:creator>rtunisi</dc:creator>
      <dc:date>2013-09-25T14:02:37Z</dc:date>
    </item>
    <item>
      <title>Re: Weird issues on VM HardDisk information Script</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Weird-issues-on-VM-HardDisk-information-Script/m-p/2706887#M93753</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You mention that you have multiple connections to vSphere servers open.&lt;/P&gt;&lt;P&gt;Are these all vCenters, or are they ESXi servers ?&lt;/P&gt;&lt;P&gt;Could it be that 1 such connection was dropped after the error ?&lt;/P&gt;&lt;P&gt;You could insert a&lt;/P&gt;&lt;BLOCKQUOTE&gt;
&lt;P&gt;$global:DefaultVIServers.Count&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;&lt;P&gt;before and after line 12 to check if that is the case.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Sep 2013 14:19:28 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Weird-issues-on-VM-HardDisk-information-Script/m-p/2706887#M93753</guid>
      <dc:creator>LucD</dc:creator>
      <dc:date>2013-09-25T14:19:28Z</dc:date>
    </item>
    <item>
      <title>Re: Weird issues on VM HardDisk information Script</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Weird-issues-on-VM-HardDisk-information-Script/m-p/2706888#M93754</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;these are all vcenters, multiple versions (4.1, 5.0 and 5.1)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;its really odd that i can use Get-VM on the same server that it claimed disconnection with no errors, something like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) Connected to 3 vCenters: vc01, vc02 and vc03&lt;/P&gt;&lt;P&gt;2) Run script and i get the error 'vc01 is not connected'&lt;/P&gt;&lt;P&gt;3) Get-VM vm01 (which happens to be at 'vc01', that just disconnected) and it retrieves it normally&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;edit:&lt;/P&gt;&lt;P&gt;ran the command with the modifications to troubleshoot disconnection like you said, and no disconnections at all ! All the 15 vCenters still connected while running the command&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The exception is below&lt;/P&gt;&lt;P&gt;Get-VIObjectByVIView : 25/09/2013 11:25:27&amp;nbsp;&amp;nbsp;&amp;nbsp; Get-VIObjectByVIView&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Server XXXXX is not connected.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Sep 2013 14:24:32 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Weird-issues-on-VM-HardDisk-information-Script/m-p/2706888#M93754</guid>
      <dc:creator>rtunisi</dc:creator>
      <dc:date>2013-09-25T14:24:32Z</dc:date>
    </item>
    <item>
      <title>Re: Weird issues on VM HardDisk information Script</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Weird-issues-on-VM-HardDisk-information-Script/m-p/2706889#M93755</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I suspect it might be an issue with the Get-VIObjectByVIView cmdlet.&lt;/P&gt;&lt;P&gt;Do you also get the error when you replace line 12 by&lt;/P&gt;&lt;BLOCKQUOTE&gt;
&lt;P&gt;$ghd = Get-HardDisk -VM $VM&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Sep 2013 16:18:55 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Weird-issues-on-VM-HardDisk-information-Script/m-p/2706889#M93755</guid>
      <dc:creator>LucD</dc:creator>
      <dc:date>2013-09-25T16:18:55Z</dc:date>
    </item>
    <item>
      <title>Re: Weird issues on VM HardDisk information Script</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Weird-issues-on-VM-HardDisk-information-Script/m-p/2706890#M93756</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;the issue does not occur when i substitute the command parameter, however, the execution time went thru the roof, as i expected. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Seconds&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : 24&lt;/P&gt;&lt;P&gt;Milliseconds&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : 93&lt;/P&gt;&lt;P&gt;(Measure-Command Statistic)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;I believe thats because of the string parameter, that forces get-harddisk cmdlet to create a VirtualMachine object (i believe it calls Get-VM, which is very, VERY slow. Thats why i used the Get-View with -ViewType in the first place). &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;Luc, is there anyway i can make this quickier without the Get-VIObjectByVIView? I tested many options while creating this script and this proved to be the most efficient one, with runtimes around 1 to 2 seconds in the same environment (as i said, the script randomly fails with the disconnection issue, sometimes i can make it work and its pretty fast )&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Sep 2013 16:44:15 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Weird-issues-on-VM-HardDisk-information-Script/m-p/2706890#M93756</guid>
      <dc:creator>rtunisi</dc:creator>
      <dc:date>2013-09-25T16:44:15Z</dc:date>
    </item>
    <item>
      <title>Re: Weird issues on VM HardDisk information Script</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Weird-issues-on-VM-HardDisk-information-Script/m-p/2706891#M93757</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try like this&lt;/P&gt;&lt;BLOCKQUOTE&gt;
&lt;P&gt;Function Get-VMDiskInfo {&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [CmdletBinding()]&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Param (&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [Parameter(Mandatory=$true,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ValueFromPipeline=$True,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ValueFromPipelineByPropertyName=$true)]&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [Alias('Name')]&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $VM&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; PROCESS{&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $VMView = Get-View -ViewType VirtualMachine -Filter @{"Name" = $VM}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $output = @()&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ForEach ($VirtualSCSIController in ($VMView.Config.Hardware.Device | Where {$_.DeviceInfo.Label -match “SCSI Controller”})){&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ForEach ($VirtualDiskDevice in ($VMView.Config.Hardware.Device | Where {$_.ControllerKey -eq $VirtualSCSIController.Key})){&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $VMSummary = “” | Select VM,Disk, SCSI, DiskType, DiskFormat, DiskSizeGB, DiskFile&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $VMSummary.VM = $VM&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $VMSummary.SCSI = [string]::Concat($VirtualSCSIController.BusNumber,":",$VirtualDiskDevice.UnitNumber)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $VMSummary.Disk = $VirtualDiskDevice.DeviceInfo.Label&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #pegando info do Get-Harddisks &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $VMSummary.DiskType = &amp;amp;{&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; switch -regex ($VirtualDiskDevice.Backing.GetType().Name){&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "Flat" {&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "Flat"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if($VirtualDiskDevice.Backing.ThinProvisioned){$VMSummary.DiskFormat = "Thin"}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else{$VMSummary.DiskFormat = "Thick"}}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "Raw" {&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "Raw" + $VirtualDiskDevice.Backing.CompatibilityMode.TrimEnd("Mode")&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Default {"Unknown"}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $VMSummary.DiskSizeGB = [Math]::Round(($VirtualDiskDevice.CapacityInKb/1MB),2)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $VMSummary.DiskFile = $VirtualDiskDevice.Backing.FileName&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $output += $VMSummary&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Write-Output $output&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Sep 2013 17:56:13 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Weird-issues-on-VM-HardDisk-information-Script/m-p/2706891#M93757</guid>
      <dc:creator>LucD</dc:creator>
      <dc:date>2013-09-25T17:56:13Z</dc:date>
    </item>
    <item>
      <title>Re: Weird issues on VM HardDisk information Script</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Weird-issues-on-VM-HardDisk-information-Script/m-p/2706892#M93758</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;simple code and trully brilliant&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;... less than 1 second execution time&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;didnt know about the &amp;amp;{} construct... will look closely to this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks really much for the PCLI lesson, Mr Dekens.. going back to study book &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.vmware.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Sep 2013 19:05:54 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Weird-issues-on-VM-HardDisk-information-Script/m-p/2706892#M93758</guid>
      <dc:creator>rtunisi</dc:creator>
      <dc:date>2013-09-25T19:05:54Z</dc:date>
    </item>
    <item>
      <title>Re: Weird issues on VM HardDisk information Script</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Weird-issues-on-VM-HardDisk-information-Script/m-p/2706893#M93759</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The &amp;amp; is the call operator, it executes the scriptblock that follows (everything between the curly braces).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Sep 2013 19:24:18 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Weird-issues-on-VM-HardDisk-information-Script/m-p/2706893#M93759</guid>
      <dc:creator>LucD</dc:creator>
      <dc:date>2013-09-25T19:24:18Z</dc:date>
    </item>
  </channel>
</rss>

