File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -10,14 +10,17 @@ Function Get-VMApplicationInfo {
10
10
CSV or JSON output file
11
11
. EXAMPLE
12
12
Get-VMApplicationInfo -VM (Get-VM "DC-01")
13
+ . EXAMPLE
14
+ Get-VMApplicationInfo -VM (Get-VM "DC-01") -UniqueOnly
13
15
. EXAMPLE
14
16
Get-VMApplicationInfo -VM (Get-VM "DC-01") -Output CSV
15
17
. EXAMPLE
16
18
Get-VMApplicationInfo -VM (Get-VM "DC-01") -Output JSON
17
19
#>
18
20
param (
19
21
[Parameter (Mandatory = $true )]$VM ,
20
- [Parameter (Mandatory = $false )][ValidateSet (" CSV" , " JSON" )][String ]$Output
22
+ [Parameter (Mandatory = $false )][ValidateSet (" CSV" , " JSON" )][String ]$Output ,
23
+ [Parameter (Mandatory = $false )][Switch ]$UniqueOnly
21
24
)
22
25
23
26
$appInfoValue = (Get-AdvancedSetting - Entity $VM - Name " guestinfo.appInfo" ).Value
@@ -28,7 +31,11 @@ Function Get-VMApplicationInfo {
28
31
$appInfo = $appInfoValue | ConvertFrom-Json
29
32
$appUpdateVersion = $appInfo.updateCounter
30
33
31
- $results = $appInfo.applications | Sort-Object - Property a | FT @ {Name = " Application" ;e = {$_.a }}, @ {Name = " Version" ;e = {$_.v }}
34
+ if ($UniqueOnly ) {
35
+ $results = $appInfo.applications | Sort-Object - Property a - Unique| FT @ {Name = " Application" ;e = {$_.a }}, @ {Name = " Version" ;e = {$_.v }}
36
+ } else {
37
+ $results = $appInfo.applications | Sort-Object - Property a | FT @ {Name = " Application" ;e = {$_.a }}, @ {Name = " Version" ;e = {$_.v }}
38
+ }
32
39
33
40
Write-host - ForegroundColor Green " Application Discovery Time: $ ( $appInfo.publishTime ) "
34
41
if ($Output -eq " CSV" ) {
You can’t perform that action at this time.
0 commit comments