Files
Intune/dump/Software-Inventory.ps1

40 lines
1.8 KiB
PowerShell

# $My_List = Import-Csv "\\ccx\shares\Users\Serverless\NNAZMAT\temp\Legacy-Servers.csv"
$Report = @()
$T = @()
$Failed_Connection = @()
$Failed_Invoke = @()
$My_List | % { $Temp = $_
If(Test-Connection $Temp.Machine -Count 1 -ErrorAction SilentlyContinue) {
If(Invoke-Command $Temp.Machine -ErrorAction SilentlyContinue { $env:COMPUTERNAME }) {
$T2 = Invoke-Command $Temp.Machine { Get-ItemProperty "HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*" |
? { $_.DisplayName -notlike "Security*" -and $_.DisplayName -notlike "Update*" -and $_.DisplayName -notlike "Hotfix*" -and $_.DisplayName -notlike "Microsoft Visual C++*" -and $_.DisplayName -notlike ""} |
Select-Object displayname, displayversion, publisher, installdate }
$T2 | % {
$Obj = New-Object -TypeName PSObject
$Obj | Add-Member -MemberType NoteProperty -Name Machine -Value $Temp.Machine
$Obj | Add-Member -MemberType NoteProperty -Name OS -Value $Temp.OS
$Obj | Add-Member -MemberType NoteProperty -Name DisplayName -Value $_.DisplayName
$Obj | Add-Member -MemberType NoteProperty -Name DisplayVersion -Value $_.DisplayVersion
$Obj | Add-Member -MemberType NoteProperty -Name Publisher -Value $_.Publisher
$Obj | Add-Member -MemberType NoteProperty -Name InstallDate -Value $_.InstallDate
$Obj
$Report += $Obj
}#$end%
}#endIfinvoke
Else { $Failed_Invoke += $Temp.Machine }
}#endIf
Else { $Failed_Connection += $Temp.Machine }
}#end%