WMIC error: desciption = exception occured when searching for hotfix -
i have wmic command want run query list of machines , homecoming csv file if hotfix installed. in case hotfix id 2617858. starts process , comes after 20 seconds: error: desciption = exception occured . works when there few machines in file need run against 40 computers.
any suggestions ? thanks
code:
wmic /failfast:on /node:@"c:\users\username\desktop\servers.txt" qfe | find "2617858" > \\computername\c$\users\username\desktop\hotfix.csv
for it's worth, might easier inquire wmic
filter rather piping wmic
through find
. this:
wmic /node:@"c:\users\username\desktop\servers.txt" qfe hotfixid="kb983590" csname /format:list >>hotfix.txt
or if problem wmic
can't handle many servers in servers.txt, seek looping through list batch for
loop.
@echo off setlocal /f "usebackq delims=" %%i in ("c:\users\username\desktop\servers.txt") ( set /p "=checking %%i... " wmic /node:%%i qfe hotfixid="kb983590" csname /format:list >>hotfix.txt 2>>failures.txt echo done. ) echo unable query next computers: type failures.txt
as alternative, can perform same action using powershell.
powershell -command "$pcs = get-content c:\users\username\desktop\servers.txt; foreach ($pc in $pcs) { get-wmiobject -computername $pc win32_quickfixengineering | where-object {$_.hotfixid -eq 'kb980232'} | select-object csname }" >>hotfix.txt
... although if wmi unresponsive on server wmic, won't have much improve luck using powershell.
wmic
No comments:
Post a Comment