-
Notifications
You must be signed in to change notification settings - Fork 50
/
Get-DeployedProduct.ps1
52 lines (48 loc) · 1.47 KB
/
Get-DeployedProduct.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<#
.NOTES
===========================================================================
Created on: 9/21/2016 12:17 PM
Created by: Brian Graf
Organization: VMware
Twitter: @vBrianGraf
Blog: www.vtagion.com
===========================================================================
.DESCRIPTION
A description of the file.
#>
<#
.SYNOPSIS
Return all Product Data from deployed VM's/OVAs in vCenter
.DESCRIPTION
This will return the Product Name, Version, Product URL, and ApplianceUrl if they are listed in the VM Product properties
.EXAMPLE
PS C:\> Get-DeployedProduct
.EXAMPLE
PS C:\> Get-DeployedProdcut | Export-Csv -Path c:\temp\deployedproducts.csv -NoTypeInformation
.NOTES
Additional information about the function.
#>
function Get-DeployedProduct
{
[CmdletBinding()]
param ()
Begin {$VMs = Get-VM * | where { $_.ExtensionData.Summary.Config.Product.Name -ne $null } }
Process
{
$Products = @()
foreach ($VM in $VMs)
{
$Properties = [ordered]@{
'VMName' = $VM.name;
'ProductName' = $VM.extensiondata.summary.config.product.name;
'Version' = $VM.extensiondata.summary.config.product.version;
'FullVersion' = $VM.extensiondata.summary.config.product.fullversion;
'ProductURL' = $VM.extensiondata.summary.config.product.producturl;
'AppURL' = $VM.extensiondata.summary.config.product.appurl
}
$obj = New-Object PSObject -Property $Properties
$Products += $obj
}
}
End { return $Products }
}