-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathget-GPCOSoftInventory.ps1
More file actions
29 lines (26 loc) · 985 Bytes
/
get-GPCOSoftInventory.ps1
File metadata and controls
29 lines (26 loc) · 985 Bytes
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
foreach($computer in Get-ADComputers) {
#$computer.cn = 'cohpmartin'
#$computer.operatingSystem = 'Windows 8.1 Pro'
$computer.cn + " - " + $computer.operatingSystem
try {
$currComputer = Get-WmiObject win32_computersystem -ComputerName $computer.cn
}
catch {
$currComputer = ''
}
$objComputer = New-Object PsObject -Property @{System = $computer.cn; Model = '{0} {1}' -f $currComputer.Manufacturer, $currComputer.Model ; OS = $computer.operatingSystem}
if (!($objComputer.OS.ToLower().Contains('server'))) {
$objWMI = Get-WmiObject win32_Product -ComputerName $objComputer.Name |
# Select Name,Version,PackageName,Installdate,Vendor |
Select Name,Version |
Sort Installdate -Descending
$strfile = "{0}\documents\WindowsPowershell\{1}.txt" -f $env:userprofile,$computer.cn
foreach ($detail in $objWMI) {
$detail.Name
$detail.Version
}
$objWMI | ft | Out-File $strfile
Get-Content $strfile
}
}