Check how many windows update are available for servers
Check how many windows update are available for servers
Hello,
I know there was a topic before to check for windows updates, but the active script in there was not working.
So that is why I try it again?
Does anyone has an script to check how many windows updates are available on al lot of windows 2008 - windows 2012 servers? I need to check these servers (all remote) and want a number in return.
I hope someone can help me with that.
I know there was a topic before to check for windows updates, but the active script in there was not working.
So that is why I try it again?
Does anyone has an script to check how many windows updates are available on al lot of windows 2008 - windows 2012 servers? I need to check these servers (all remote) and want a number in return.
I hope someone can help me with that.
What exactly script you are using?I know there was a topic before to check for windows updates, but the active script in there was not working.
What exactly means "not working"? What error do you see?
If you can use single admin account for all remote systems, try this scriptDoes anyone has an script to check how many windows updates are available on al lot of windows 2008 - windows 2012 servers? I need to check these servers (all remote) and want a number in return.
(Shell Script test method, 1 parameter - target hostname)
Code: Select all
Option Explicit
const statusAlive = "scriptRes:Host is alive:"
const statusDead = "scriptRes:No answer:"
const statusUnknown = "scriptRes:Unknown:"
const statusNotResolved = "scriptRes:Unknown host:"
const statusOk = "scriptRes:Ok:"
const statusBad = "scriptRes:Bad:"
const statusBadContents = "scriptRes:Bad contents:"
dim updateSession, updateSearcher, searchResult
if objArgs.Count>1 then
strComputer = objArgs(0)
Set updateSession = CreateObject
("Microsoft.Update.Session",strComputer)
Set updateSearcher = updateSession.CreateupdateSearcher()
Set searchResult = updateSearcher.Search("IsInstalled=0 and Type='Software'")
if searchResult.Updates.Count>0 then
WScript.StdOut.Write statusBad & searchResult.Updates.Count & " updates found!"
else
WScript.StdOut.Write statusOk & "No new updates found."
End If
else
WScript.StdOut.WriteLine statusUnknown & "Not enough parameters specified"
end if
Alex
Hi Alex,
Thank you for your fast respons.
I tried all the sripts in this thread:
http://www.ks-soft.net/cgi-bin/phpBB/vi ... ows+update
I have many servers in different vlan's with different admin accounts, but in every vlan is a domain controller upon which I have installed an r.m.a. agent.
So basically i can use the scipt you provided in this thread, because I can use
the r.m.a. agent needed for the specific server.
When I use your script, I get an unknown error.
This is my 'start cmd' cmd /c cscript /B /E:VBScript %Script% %Params%
then your script and in the field 'Params' I type in the name of the server. Even localhost or the IP-address gives me the unknown error.
Maybe I overlooked something?
Thank you for your fast respons.
I tried all the sripts in this thread:
http://www.ks-soft.net/cgi-bin/phpBB/vi ... ows+update
I have many servers in different vlan's with different admin accounts, but in every vlan is a domain controller upon which I have installed an r.m.a. agent.
So basically i can use the scipt you provided in this thread, because I can use
the r.m.a. agent needed for the specific server.
When I use your script, I get an unknown error.
This is my 'start cmd' cmd /c cscript /B /E:VBScript %Script% %Params%
then your script and in the field 'Params' I type in the name of the server. Even localhost or the IP-address gives me the unknown error.
Maybe I overlooked something?
Hi Alex,
This script seems to work:
But then again, i cannot give in a servername.
And I see now that it gives me the 'OK' status..but i have Windows 2008 Service Pack 2 as important update not yet installed. And I see this in my Windows Update screen.
This script seems to work:
Code: Select all
const statusAlive = "scriptRes:Host is alive:"
const statusDead = "scriptRes:No answer:"
const statusUnknown = "scriptRes:Unknown:"
const statusNotResolved = "scriptRes:Unknown host:"
const statusOk = "scriptRes:Ok:"
const statusBad = "scriptRes:Bad:"
const statusBadContents = "scriptRes:Bad contents:"
' check this category for 'High Priority' updates
category = "UpdateClassification"
highpriority = ",Security Updates,Update Rollups,Critical Updates,Service Packs"
' create instance of update.searcher (offline)
Set objSearcher = CreateObject("Microsoft.Update.Searcher")
objSearcher.Online = 1
' find and fetch collection of updates
Set objResults = objSearcher.Search("Type='Software' and IsInstalled=0")
Set colUpdates = objResults.Updates
count = 0
titles = ""
For i = 0 to colUpdates.Count - 1
' check categories
Set colCategories = colUpdates.Item(i).Categories
For c = 0 to colCategories.Count - 1
If colCategories.item(c).Type = category _
And InStr(highPriority, "," & colCategories.item(c).Name & ",") > 0 Then
count = count + 1
titles = titles & vbCRLF & colUpdates.Item(i).Title
End If
Next
Next
if count > 0 then
WScript.StdOut.Write statusBad & colupdates.Updates.Count & " critical updates found!"
else
WScript.StdOut.Write statusOk 'No new critical updates found
End If
'If count > 0 Then
'Wscript.Echo count & " pending updates:" & titles
'Wscript.Quit 2
'Else
'Wscript.Echo "No pending updates"
'Wscript.Quit 0
'End If
And I see now that it gives me the 'OK' status..but i have Windows 2008 Service Pack 2 as important update not yet installed. And I see this in my Windows Update screen.
-
- Posts: 2832
- Joined: Tue May 16, 2006 4:41 am
- Contact:
Added some error checking.
No parameters should be specified for local system.
Or one parameter - host name/IP of target system
No parameters should be specified for local system.
Or one parameter - host name/IP of target system
Code: Select all
Option Explicit
On Error Resume Next
const statusAlive = "scriptRes:Host is alive:"
const statusDead = "scriptRes:No answer:"
const statusUnknown = "scriptRes:Unknown:"
const statusNotResolved = "scriptRes:Unknown host:"
const statusOk = "scriptRes:Ok:"
const statusBad = "scriptRes:Bad:"
const statusBadContents = "scriptRes:Bad contents:"
dim updateSession, updateSearcher, searchResult, objArgs
Set objArgs = WScript.Arguments
checkForError(1)
if objArgs.Count=0 Then
Set updateSession = CreateObject("Microsoft.Update.Session")
else
Set updateSession = CreateObject("Microsoft.Update.Session",objArgs(0))
end if
checkForError(2)
Set updateSearcher = updateSession.CreateupdateSearcher()
checkForError(3)
Set searchResult = updateSearcher.Search("IsInstalled=0 and Type='Software'")
checkForError(4)
if searchResult.Updates.Count>0 then
WScript.StdOut.Write statusBad & searchResult.Updates.Count & " updates found!"
else
WScript.StdOut.Write statusOk & "No new updates found."
End If
Sub checkForError(txt)
If Err.Number <> 0 Then
WScript.StdOut.Write statusUnknown & "(" & txt & ") " &Err.Description
WScript.Quit
End If
End Sub
Strange issue is happening:
When i use the scipt you just posted and test it like a normal test. I gives me the 'Bad' status reply.
When i test in the Shell Script screen i get this result:
[9:38:18 PM] HostMonitor is going to execute "WindowsUpdate -alex van forum" script ...
[9:38:26 PM] Script executed, correct result received:
----------
- Status: Bad
- Reply: 2 updates found!
----------
Also a kind of strange, because i see only 1 update ready in the windows update screen.
When i use the scipt you just posted and test it like a normal test. I gives me the 'Bad' status reply.
When i test in the Shell Script screen i get this result:
[9:38:18 PM] HostMonitor is going to execute "WindowsUpdate -alex van forum" script ...
[9:38:26 PM] Script executed, correct result received:
----------
- Status: Bad
- Reply: 2 updates found!
----------
Also a kind of strange, because i see only 1 update ready in the windows update screen.
And when i use the Shell Script screen and test with an R.M.A agent and a parameter (the server name). I get this:
[9:53:25 PM] Agent: active-ade-amf-sbs001.-----.local is going to execute "WindowsUpdate -alex van forum" script ...
[9:53:35 PM] Agent error: no responce from agent within specified timeout
Even with a timeout of 600 sec.
[9:53:25 PM] Agent: active-ade-amf-sbs001.-----.local is going to execute "WindowsUpdate -alex van forum" script ...
[9:53:35 PM] Agent error: no responce from agent within specified timeout
Even with a timeout of 600 sec.
-
- Posts: 2832
- Joined: Tue May 16, 2006 4:41 am
- Contact:
"Shell Script screen" also returns Bad status (more than 0 updates found.)trange issue is happening:
When i use the scipt you just posted and test it like a normal test. I gives me the 'Bad' status reply.
When i test in the Shell Script screen i get this result:
You may show update name using searchResult.Updates.Item(0)
Script that shows last available Update may look like the following:
Option Explicit
On Error Resume Next
const statusAlive = "scriptRes:Host is alive:"
const statusDead = "scriptRes:No answer:"
const statusUnknown = "scriptRes:Unknown:"
const statusNotResolved = "scriptRes:Unknown host:"
const statusOk = "scriptRes:Ok:"
const statusBad = "scriptRes:Bad:"
const statusBadContents = "scriptRes:Bad contents:"
dim updateSession, updateSearcher, searchResult, objArgs
Set objArgs = WScript.Arguments
checkForError(1)
if objArgs.Count=0 Then
Set updateSession = CreateObject("Microsoft.Update.Session")
else
Set updateSession = CreateObject("Microsoft.Update.Session",objArgs(0))
end if
checkForError(2)
Set updateSearcher = updateSession.CreateupdateSearcher()
checkForError(3)
Set searchResult = updateSearcher.Search("IsInstalled=0 and Type='Software'")
checkForError(4)
if searchResult.Updates.Count>0 then
WScript.StdOut.Write statusBad & searchResult.Updates.Count & " updates found. (last: " & searchResult.Updates.Item(searchResult.Updates.Count-1) & ")"
else
WScript.StdOut.Write statusOk & "No new updates found."
End If
Sub checkForError(txt)
If Err.Number <> 0 Then
WScript.StdOut.Write statusUnknown & "(" & txt & ") " &Err.Description
WScript.Quit
End If
End Sub
Try to start script manually on RMA system without "/B" command line switch[9:53:25 PM] Agent: active-ade-amf-sbs001.-----.local is going to execute "WindowsUpdate -alex van forum" script ...
[9:53:35 PM] Agent error: no responce from agent within specified timeout Even with a timeout of 600 sec.
RMA started as service?
what account do you use to run agent?
UAC enabled?
Regards
Alex
That, gives me this answer:
[10:39:11 PM] Script executed, correct result received:
----------
- Status: Bad
- Reply: 2 updates found. (last: Microsoft .NET Framework 4 for Windows Server 2008 x64-based Systems (KB982671))
----------
But still in hostmonitor itself it only says: Bad. (not why, or how many).
And remote isn't working as I described.
Sorry to bother you with this..
[10:39:11 PM] Script executed, correct result received:
----------
- Status: Bad
- Reply: 2 updates found. (last: Microsoft .NET Framework 4 for Windows Server 2008 x64-based Systems (KB982671))
----------
But still in hostmonitor itself it only says: Bad. (not why, or how many).
And remote isn't working as I described.
Sorry to bother you with this..
KS-Soft wrote:Try to start script manually on RMA system without "/B" command line switch[9:53:25 PM] Agent: active-ade-amf-sbs001.-----.local is going to execute "WindowsUpdate -alex van forum" script ...
[9:53:35 PM] Agent error: no responce from agent within specified timeout Even with a timeout of 600 sec.
Doesn't work.
RMA started as service?
Yes
what account do you use to run agent?
New created domain-admin account.
UAC enabled?
User Access Control is disabled.
Regards
Alex
Don't see how this may happen- Status: Bad
- Reply: 2 updates found. (last: Microsoft .NET Framework 4 for Windows Server 2008 x64-based Systems (KB982671))
----------
But still in hostmonitor itself it only says: Bad. (not why, or how many).
----------
if searchResult.Updates.Count>0 then
WScript.StdOut.Write statusBad & searchResult.Updates.Count & " updates found. (last: " & searchResult.Updates.Item(searchResult.Updates.Count-1) & ")"

Could you please send screen shots to support@ks-soft.net?
Regards
Alex