URL: https://www.overclockers.at/coding-stuff/powershell-get-remoteprogram_243971/page_1 - zur Vollversion wechseln!
Hallo Leute,
ich bin unlängst auf ein echt tolles PowerShell Skript von Jaap Brasser gestoßen, Get-RemoteProgram, welches vom lokalen und auch im Netzwerk erreichbaren Windows PCs die installierte Software abfragen kann. Ich verwende es um veraltete Software ausfindig zu machen. Ich füttere es mit einer Liste von Computernamen und erhalte eine HTML-Datei mit den entsprechenden Ergebnissen.
Hier zwei Code-Schnipsel für Selbermacher:
Finde alte Java Versionen:
Code: POWERSHELLGet-RemoteProgram -Property DisplayVersion,UninstallString,IsMinorUpgrade,ReleaseType,ParentDisplayName,SystemComponent -ComputerName (Get-Content .\\hostlist.txt) -ErrorAction SilentlyContinue | Where-Object {[string]$_.SystemComponent -ne 1 -and ![string]$_.IsMinorUpgrade -and ![string]$_.ReleaseType -and ![string]$_.ParentDisplayName -and $_.ProgramName -like "*Java*" -and $_.DisplayVersion -NotMatch "8.0.710.15"} | Sort-Object ComputerName | ConvertTo-Html ComputerName, ProgramName, DisplayVersion, UninstallString | Set-Content .\\old-Java.htm
Code: POWERSHELLGet-RemoteProgram -Property DisplayVersion,UninstallString,IsMinorUpgrade,ReleaseType,ParentDisplayName,SystemComponent -ComputerName (Get-Content .\\hostlist.txt) -ErrorAction SilentlyContinue | Where-Object {[string]$_.SystemComponent -ne 1 -and ![string]$_.IsMinorUpgrade -and ![string]$_.ReleaseType -and ![string]$_.ParentDisplayName -and $_.ProgramName -like "*Adobe Flash Player*" -and $_.DisplayVersion -NotMatch "20.0.0.286"} | Sort-Object ComputerName | ConvertTo-Html ComputerName, ProgramName, DisplayVersion, UninstallString | Set-Content .\\old-Flash.htm
Als kleine Zugabe hier das Skript mit dem ich eine Hostlist von Windows 7 PCs erzeuge:
Code: POWERSHELL$hostlist = ".\\hostlist.txt" if (Test-Path $hostlist) { Remove-Item $hostlist } Get-ADComputer -Filter {OperatingSystem -Like "Windows 7*"} -Property 'Name' | Select-Object -Property Name | Sort-Object Name >> hostlist.txt (Get-Content hostlist.txt) | Foreach {$_.TrimEnd()} | where {$_ -ne ""} | Select-Object -Skip 2 | Set-Content hostlist.txt
Zitat von mr.nice.Habe Code-Tags wieder entfernt, weil die \ verloren gehen.
Code:$hostlist = ".\\hostlist.txt"
Danke für den Hinweis, wirklich schöner wird's mit den Code-Tags leider auch nicht, aber ich lass es mal so stehen.
overclockers.at v4.thecommunity
© all rights reserved by overclockers.at 2000-2025