vbscript code to read input from text file avoiding manual efforts

后端 未结 2 1457
故里飘歌
故里飘歌 2021-01-28 00:29

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

2条回答
  •  借酒劲吻你
    2021-01-28 01:08

    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

提交回复
热议问题