I am drilling down Internet to get Vbscript code, where input is read from text file one per line and pass it to the commands in script. I am just a beginner and need help with
If you are trying to get the pending windows update installs for a bunch of computers, you can use this in Powershell:
$computers = gc text_file_of_computers.txt
ForEach ($computer in $computers) {
("-" * 30)+"`n" # Horizontal line
Write-Host "Patches not yet installed for $($computer)" -f "Yellow"
Get-Hotfix -co $computer| Where {$_.InstalledOn -eq $null}
"`n"+("-" * 30) # Horizontal line
}
As you can see, we only show patches which have a $null
value for InstalledOn
, which means they have not been installed as yet.
powershell