Fix for formatting Get-HVMachineSummary and empty search results.

Displays proper meesage for Get-HVMachine/Get-HVMAchineSummary, incase
of empty search results. Dispalying Agent sataus for
Get-HVMachineSummary result.
This commit is contained in:
praveenmathamsetty
2016-12-19 13:07:44 +05:30
parent 8b0750a94e
commit df17793ede
2 changed files with 32 additions and 24 deletions

View File

@@ -29,7 +29,7 @@
<Label>User Assignment</Label>
</TableColumnHeader>
<TableColumnHeader>
<Width>8</Width>
<Width>7</Width>
<Label>Enabled</Label>
</TableColumnHeader>
<TableColumnHeader>
@@ -117,27 +117,27 @@
<TableControl>
<TableHeaders>
<TableColumnHeader>
<Width>16</Width>
<Width>15</Width>
<Label>Machine</Label>
</TableColumnHeader>
<TableColumnHeader>
<Width>16</Width>
<Width>12</Width>
<Label>DesktopPool</Label>
</TableColumnHeader>
<TableColumnHeader>
<Width>16</Width>
<Width>12</Width>
<Label>DNS Name</Label>
</TableColumnHeader>
<TableColumnHeader>
<Width>16</Width>
<Width>8</Width>
<Label>User</Label>
</TableColumnHeader>
<TableColumnHeader>
<Width>16</Width>
<Width>15</Width>
<Label>Host</Label>
</TableColumnHeader>
<TableColumnHeader>
<Width>8</Width>
<Width>5</Width>
<Label>Agent</Label>
</TableColumnHeader>
<TableColumnHeader>
@@ -145,9 +145,8 @@
<Label>Datastore</Label>
</TableColumnHeader>
<TableColumnHeader>
<Width>10</Width>
<Width>15</Width>
<Label>Status</Label>
<Alignment>Right</Alignment>
</TableColumnHeader>
</TableHeaders>
<TableRowEntries>
@@ -169,13 +168,13 @@
<ScriptBlock>$_.ManagedMachineNamesData.HostName</ScriptBlock>
</TableColumnItem>
<TableColumnItem>
<ScriptBlock>$_.Data.AgentVersion</ScriptBlock>
<ScriptBlock>$_.Base.AgentVersion</ScriptBlock>
</TableColumnItem>
<TableColumnItem>
<ScriptBlock>$_.ManagedMachineNamesData.DatastorePaths</ScriptBlock>
</TableColumnItem>
<TableColumnItem>
<ScriptBlock>$_.Data.BasicState</ScriptBlock>
<ScriptBlock>$_.Base.BasicState</ScriptBlock>
</TableColumnItem>
</TableColumnItems>
</TableRowEntry>
@@ -212,12 +211,16 @@
<ScriptBlock>$_.ManagedMachineNamesData.HostName</ScriptBlock>
</ListItem>
<ListItem>
<Label>Enabled</Label>
<Label>Agent</Label>
<ScriptBlock>$_.Base.AgentVersion</ScriptBlock>
</ListItem>
<ListItem>
<Label>Datastore</Label>
<ScriptBlock>$_.ManagedMachineNamesData.DatastorePaths</ScriptBlock>
</ListItem>
<ListItem>
<Label>Sessions</Label>
<ScriptBlock>$_.Data.BasicState</ScriptBlock>
<Label>Status</Label>
<ScriptBlock>$_.Base.BasicState</ScriptBlock>
</ListItem>
</ListItems>
</ListEntry>

View File

@@ -5136,16 +5136,17 @@ function Get-HVMachine {
}
$machineList = Find-HVMachine -Param $PSBoundParameters
if ($full) {
$queryResults = @()
$desktop_helper = New-Object VMware.Hv.MachineService
foreach ($id in $machineList.id) {
$info = $desktop_helper.Machine_Get($services,$id)
$queryResults += $info
}
$machineList = $queryResults
if (!$machineList) {
Write-Host "No Virtual Machine(s) Found with given search parameters"
break
}
$queryResults = @()
$desktop_helper = New-Object VMware.Hv.MachineService
foreach ($id in $machineList.id) {
$info = $desktop_helper.Machine_Get($services,$id)
$queryResults += $info
}
$machineList = $queryResults
return $machineList
}
@@ -5252,8 +5253,12 @@ function Get-HVMachineSummary {
}
$machineList = Find-HVMachine -Param $PSBoundParameters
if (!$machineList) {
Write-Host "No Virtual Machine(s) Found with given search parameters"
break
}
return $machineList
}
Export-ModuleMember Add-HVDesktop,Add-HVRDSServer,Connect-HVEvent,Disconnect-HVEvent,Get-HVEvent,Get-HVFarm,Get-HVFarmSummary,Get-HVPool,Get-HVPoolSummary,Get-HVMachine,Get-HVMachineSummary,Get-HVQueryResult,Get-HVQueryFilter,New-HVFarm,New-HVPool,Remove-HVFarm,Remove-HVPool,Set-HVFarm,Set-HVPool,Start-HVFarm,Start-HVPool