Link to home
Start Free TrialLog in
Avatar of bsharath
bsharathFlag for India

asked on

Find all machines if Windows automatic updates is enabled or disabled

Hi,

As we have our windows update server which pushes all updates to the machines the Mycomputer > Properties > Automatic updates is disabled. I need a script to query this part and tell me if it is disabled or enabled.So users enable it...

I have the machine names in the file.

In the registry what is the key that can turn this on.

Regards
Sharath
Avatar of Brian Pierce
Brian Pierce
Flag of United Kingdom of Great Britain and Northern Ireland image

@echo off
:: check windows autoupdate is enabled "switched on" computers found in the list c:\computers.txt
::
:: save as checkALLWUA.cmd
:: Gastone Canali
:: file needed:
:: c:\computers.txt
:: c:\checkWUA.vbs
:: c:\psexec.exe
setlocal ENABLEDELAYEDEXPANSION
for /f %%c in ('type c:\computers.txt') do (
  set t=
  (ping -n 1 -w 999 %%c|find /i "TTL" >nul)&&  call:_checkWUA %%c
  (ping -n 1 -w 999 %%c|find /i "TTL" >nul) ||echo %%c:  switched off
)
goto :_END
:_checkWUA
  copy /Y c:\checkWUA.vbs \\%%C\admin$\temp
  c:\psexec.exe -i -s psexec.exe \\%%c  -i -s cscript.exe //nologo  "c:\windows\temp\checkWUA.vbs"
goto :_EOF
:_END
:_EOF


'*** vbs script start here
' save as checkWUA.vbs in c:\
'Set WshNetwork = WScript.CreateObject("WScript.Network")
ComputerName = WshNetwork.ComputerName

Set objAutoUpdate = CreateObject("Microsoft.Update.AutoUpdate")
Set objSettings = objAutoUpdate.Settings

Select Case objSettings.NotificationLevel
    Case 0
        Wscript.Echo ComputerName & " :Notification level, Automatic Updates is not configured by the user " & _
            "or by a Group Policy administrator."
    Case 1
        Wscript.Echo ComputerName & " :Notification level, Automatic Updates is disabled."
    Case 2
        Wscript.Echo ComputerName & " :Notification level, Automatic Updates prompts users to approve updates " & _
            "before downloading or installing."
    Case 3
        Wscript.Echo ComputerName & " :Notification level, Automatic Updates automatically downloads " & _
             "updates, but prompts users to approve them before installation."
    Case 4
        Wscript.Echo ComputerName & " :Notification level, Automatic Updates automatically installs " & _
            "updates per the schedule specified by the user."
    Case Else
        Wscript.Echo ComputerName & " :Notification level could not be determined."
End Select



Avatar of bsharath

ASKER

I get this...

The network path was not found.
        0 file(s) copied.

PsExec v1.63 - Execute processes remotely
Copyright (C) 2001-2005 Mark Russinovich
Sysinternals - www.sysinternals.com

Couldn't access %c:
The network path was not found.

Make sure that the default admin$ share is enabled on %c.
Press any key to continue . . .
sorry, there was an error in both scripts.

@echo off
:: check windows autoupdate is enabled "switched on" computers found in the list c:\computers.txt
:: correct version
:: save as checkALLWUA.cmd
:: Gastone Canali
:: file needed:
:: c:\computers.txt
:: c:\checkWUA.vbs
:: c:\psexec.exe
setlocal ENABLEDELAYEDEXPANSION
for /f %%c in ('type c:\computers.txt') do (
  set t=
  (ping -n 1 -w 999 %%c|find /i "TTL" >nul)&&  call:_checkWUA %%c
  (ping -n 1 -w 999 %%c|find /i "TTL" >nul) ||echo %%c:  switched off
)
goto :_END
:_checkWUA
  copy /Y c:\checkWUA.vbs \\%1\admin$\temp
  c:\psexec.exe  \\%1  -i -s cscript.exe //nologo  "c:\windows\temp\checkWUA.vbs"
goto :_EOF
:_END
:_EOF

'*** vbs script start here
' save as checkWUA.vbs in c:\
' corrected version
Set WshNetwork = WScript.CreateObject("WScript.Network")
ComputerName = WshNetwork.ComputerName

Set objAutoUpdate = CreateObject("Microsoft.Update.AutoUpdate")
Set objSettings = objAutoUpdate.Settings

Select Case objSettings.NotificationLevel
    Case 0
        Wscript.Echo ComputerName & " :Notification level, Automatic Updates is not configured by the user " & _
            "or by a Group Policy administrator."
    Case 1
        Wscript.Echo ComputerName & " :Notification level, Automatic Updates is disabled."
    Case 2
        Wscript.Echo ComputerName & " :Notification level, Automatic Updates prompts users to approve updates " & _
            "before downloading or installing."
    Case 3
        Wscript.Echo ComputerName & " :Notification level, Automatic Updates automatically downloads " & _
             "updates, but prompts users to approve them before installation."
    Case 4
        Wscript.Echo ComputerName & " :Notification level, Automatic Updates automatically installs " & _
            "updates per the schedule specified by the user."
    Case Else
        Wscript.Echo ComputerName & " :Notification level could not be determined."
End Select
Which file should i run and where will the results come to..

I created 2 files and ran the cmd file but no results..


Save the 1st  cmd batch as c:\checkALLWUA.cmd
::*** batch start here checkALLWUA.cmd
@echo off
:: check windows autoupdate is enabled "switched on" computers found in the list c:\computers.txt
:: correct version
:: save as checkALLWUA.cmd
:: Gastone Canali
:: file needed:
:: c:\computers.txt
:: c:\checkWUA.vbs
:: c:\psexec.exe
setlocal ENABLEDELAYEDEXPANSION
for /f %%c in ('type c:\computers.txt') do (
  set t=
  (ping -n 1 -w 999 %%c|find /i "TTL" >nul)&&  call:_checkWUA %%c
  (ping -n 1 -w 999 %%c|find /i "TTL" >nul) ||echo %%c:  switched off
)
goto :_END
:_checkWUA
  copy /Y c:\checkWUA.vbs \\%1\admin$\temp
  c:\psexec.exe  \\%1  -i -s cscript.exe //nologo  "c:\windows\temp\checkWUA.vbs"
goto :_EOF
:_END
:_EOF
::*** end batch here checkALLWUA.cmd
 
------------------------------------------------------------------------------------------------
Save the 2nd file checkWUA.vbs in c:\

'*** vbs script start here checkWUA.vbs
' save as checkWUA.vbs in c:\
' corrected version
Set WshNetwork = WScript.CreateObject("WScript.Network")
ComputerName = WshNetwork.ComputerName

Set objAutoUpdate = CreateObject("Microsoft.Update.AutoUpdate")
Set objSettings = objAutoUpdate.Settings

Select Case objSettings.NotificationLevel
    Case 0
        Wscript.Echo ComputerName & " :Notification level, Automatic Updates is not configured by the user " & _
            "or by a Group Policy administrator."
    Case 1
        Wscript.Echo ComputerName & " :Notification level, Automatic Updates is disabled."
    Case 2
        Wscript.Echo ComputerName & " :Notification level, Automatic Updates prompts users to approve updates " & _
            "before downloading or installing."
    Case 3
        Wscript.Echo ComputerName & " :Notification level, Automatic Updates automatically downloads " & _
             "updates, but prompts users to approve them before installation."
    Case 4
        Wscript.Echo ComputerName & " :Notification level, Automatic Updates automatically installs " & _
            "updates per the schedule specified by the user."
    Case Else
        Wscript.Echo ComputerName & " :Notification level could not be determined."
End Select
'*** vbs script end here checkWUA.vbs

After these run the batch c:\checkALLWUA.cmd
if u want the output in a file
c:\checkALLWUA.cmd >myresult.txt
I get this.

What does this mean.
        1 file(s) copied.
DEV-CHEN-MRD100 :Notification level, Automatic Updates automatically installs updates per the schedule specified by the user.


And what is the file that is copied.

http://support.microsoft.com/kb/306525
http://technet2.microsoft.com/windowsserver/en/library/51c8a814-6665-4d50-a0d8-2ae27e69ca7c1033.mspx?mfr=true
you can have different situationson your computer
1)
:Notification level, Automatic Updates is not configured by the user or by a Group Policy administrator.
2)  
 :Notification level, Automatic Updates is disabled.
3)
:Notification level, Automatic Updates prompts users to approve updates before downloading or installing
4)
:Notification level, Automatic Updates automatically downloads updates, but prompts users to approve them before installation."
5)
:Notification level, Automatic Updates automatically installs updates per the schedule specified by the user."
6)
  ComputerName & " :Notification level could not be determined."

So what does this mean?

Notification level, Automatic Updates automatically installs updates per the schedule specified by the user.

What is the file that's being copied.?
ASKER CERTIFIED SOLUTION
Avatar of Gastone Canali
Gastone Canali
Flag of Italy image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial