Guest User

Untitled

a guest
Oct 24th, 2017
292
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. If RegValueExists(strKeyPath, strValueName) Then
  2.  oReg.GetDWORDValue HKLM,strKeyPath,strValueName,dwValue
  3.  Resultmsg = Resultmsg & strMsg & GetAUOptions(dwValue) & VBCRLF
  4.  
  5.  If dwValue = "4" Then
  6.   strMsg = "  - Scheduled Install Day:  "
  7.   strKeyPath = "Software\Policies\Microsoft\Windows\WindowsUpdate\AU"
  8.   strValueName = "ScheduledInstallDay"
  9.   If RegValueExists(strKeyPath, strValueName) Then
  10.    oReg.GetDWORDValue HKLM,strKeyPath,strValueName,dwValue
  11.    Resultmsg = Resultmsg & strMsg & getday(dwValue) & VBCRLF
  12.   Else
  13.    Resultmsg = Resultmsg & strMsg & "Value not configured" & VBCRLF
  14.   End If
  15.  
  16.   strMsg = "  - Planned Installation Time:  "
  17.   strKeyPath = "Software\Policies\Microsoft\Windows\WindowsUpdate\AU"
  18.   strValueName = "ScheduledInstallTime"
  19.   If RegValueExists(strKeyPath, strValueName) Then
  20.    oReg.GetDWORDValue HKLM,strKeyPath,strValueName,dwValue
  21.    Resultmsg = Resultmsg & strMsg & dwValue &":00 - 24 hours 4:00 is 4 AM, 16:00 is 4 PM" & VBCRLF
  22.   Else
  23.    Resultmsg = Resultmsg & strMsg & "Value not configured" & VBCRLF
  24.   End If
  25.  Else
  26.    Resultmsg = Resultmsg & VBCRLF
  27.  End If
  28.  
  29. Else
  30.  Resultmsg = Resultmsg & strMsg & "Value is not configured" & VBCRLF
  31.  strMsg = "  - Benutzerdefinierte Einstellung:  "
  32.  strKeyPath = "Software\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update"
  33.  strValueName = "AUOptions"
  34.  If RegValueExists(strKeyPath, strValueName) Then
  35.   oReg.GetDWORDValue HKLM,strKeyPath,strValueName,dwValue
  36.   Resultmsg = Resultmsg & strMsg & GetAUOptions(dwValue) & VBCRLF
  37.  
  38.   If dwValue = "4" Then
  39.    strMsg = "    - ScheduledInstallDay:  "
  40.    strKeyPath = "Software\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update"
  41.    strValueName = "ScheduledInstallDay"
  42.    If RegValueExists(strKeyPath, strValueName) Then
  43.     oReg.GetDWORDValue HKLM,strKeyPath,strValueName,dwValue
  44.     Resultmsg = Resultmsg & strMsg & getday(dwValue) & VBCRLF
  45.    Else
  46.     Resultmsg = Resultmsg & strMsg & "Automatic Updates are not configured" & VBCRLF
  47.    End If
  48.  
  49.    strMsg = "    - ScheduledInstallTime:  "
  50.    strKeyPath = "Software\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update"
  51.    strValueName = "ScheduledInstallTime"
  52.    If RegValueExists(strKeyPath, strValueName) Then
  53.     oReg.GetDWORDValue HKLM,strKeyPath,strValueName,dwValue
  54.     Resultmsg = Resultmsg & strMsg & dwValue &":00" & VBCRLF
  55.    Else
  56.     Resultmsg = Resultmsg & strMsg & "Automatic Updates are not configured" & VBCRLF
  57.    End If
  58.   Else
  59.     Resultmsg = Resultmsg & VBCRLF
  60.   End If
  61.  
  62.  Else
  63.   Resultmsg = Resultmsg & strMsg & "Not configured" & VBCRLF
  64.  End If
  65. End If
  66.  
  67. strMsg = "  - NoAUShutdownOption:  "
  68. strKeyPath = "Software\Policies\Microsoft\Windows\WindowsUpdate\AU"
  69. strValueName = "NoAUShutdownOption"
  70. If RegValueExists(strKeyPath, strValueName) Then
  71.  oReg.GetDWORDValue HKLM,strKeyPath,strValueName,dwValue
  72.  Resultmsg = Resultmsg & strMsg & GetNoAUShutdownOption(dwValue) & VBCRLF & VBCRLF
  73. Else
  74.  Resultmsg = Resultmsg & strMsg & "Value not configured" & VBCRLF & VBCRLF
  75. End If
  76.  
  77. strMsg = "AutoInstallMinorUpdates:  "
  78. strKeyPath = "Software\Policies\Microsoft\Windows\WindowsUpdate\AU"
  79. strValueName = "AutoInstallMinorUpdates"
  80. If RegValueExists(strKeyPath, strValueName) Then
  81.  oReg.GetDWORDValue HKLM,strKeyPath,strValueName,dwValue
  82.  Resultmsg = Resultmsg & strMsg & GetAutoInstallMinorUpdates(dwValue) & VBCRLF & VBCRLF
  83. Else
  84.  Resultmsg = Resultmsg & strMsg & "Value is not configured" & VBCRLF & VBCRLF
  85. End If
  86.  
  87. strMsg = "DetectionFrequency:  "
  88. strKeyPath = "Software\Policies\Microsoft\Windows\WindowsUpdate\AU"
  89. strValueName = "DetectionFrequency"
  90.  If RegValueExists(strKeyPath, strValueName) Then
  91.   oReg.GetDWORDValue HKLM,strKeyPath,strValueName,dwValue
  92.   Resultmsg = Resultmsg & strMsg &"Every " & dwValue &" Hours to search for updates"& VBCRLF
  93.  Else
  94.    Resultmsg = Resultmsg & strMsg & "Value is not configured"& VBCRLF
  95.  End If
  96.  
  97. strMsg = "RebootRelaunchTimeout:  "
  98. strKeyPath = "Software\Policies\Microsoft\Windows\WindowsUpdate\AU"
  99. strValueName = "RebootRelaunchTimeout"
  100.  If RegValueExists(strKeyPath, strValueName) Then
  101.   oReg.GetDWORDValue HKLM,strKeyPath,strValueName,dwValue
  102.   Resultmsg = Resultmsg & strMsg & dwValue &" Minutes to wait until system restart"& VBCRLF
  103.  Else
  104.    Resultmsg = Resultmsg & strMsg & "Value is not configured" & VBCRLF
  105.  End If
  106.  
  107. strMsg = "RebootWarningTimeout:  "
  108. strKeyPath = "Software\Policies\Microsoft\Windows\WindowsUpdate\AU"
  109. strValueName = "RebootWarningTimeout"
  110.  If RegValueExists(strKeyPath, strValueName) Then
  111.   oReg.GetDWORDValue HKLM,strKeyPath,strValueName,dwValue
  112.   Resultmsg = Resultmsg & strMsg & dwValue &" Minutes wait until system restart"& VBCRLF
  113.  Else
  114.    Resultmsg = Resultmsg & strMsg & "Value not configured" & VBCRLF
  115. End If
  116.  
  117. strMsg = "NoAutoRebootWithLoggedOnUsers:  "
  118. strKeyPath = "Software\Policies\Microsoft\Windows\WindowsUpdate\AU"
  119. strValueName = "NoAutoRebootWithLoggedOnUsers"
  120. If RegValueExists(strKeyPath, strValueName) Then
  121.  oReg.GetDWORDValue HKLM,strKeyPath,strValueName,dwValue
  122.  Resultmsg = Resultmsg & strMsg & GetNoAutoReboot(dwValue) & VBCRLF
  123. Else
  124.  Resultmsg = Resultmsg & strMsg & "Value not configured" & VBCRLF
  125.  Resultmsg = Resultmsg & "  - Default: User will be presented with a 5 minutes countdown" & VBCRLF
  126. End If
  127.  
  128. strMsg = "RescheduleWaitTime:  "
  129. strKeyPath = "Software\Policies\Microsoft\Windows\WindowsUpdate\AU"
  130. strValueName = "RescheduleWaitTime"
  131. If RegValueExists(strKeyPath, strValueName) Then
  132.  oReg.GetDWORDValue HKLM,strKeyPath,strValueName,dwValue
  133.  If dwValue = "0" Then Resultmsg = Resultmsg & strMsg & "Value not configured: " & dwValue & VBCRLF & VBCRLF End If
  134.  If dwValue = "1" Then Resultmsg = Resultmsg & strMsg & dwValue &" Minute" & VBCRLF & VBCRLF End If
  135.  If dwValue > "1" and dwValue < "61" Then Resultmsg = Resultmsg & strMsg & dwValue &" Minutes" & VBCRLF & VBCRLF End If
  136.  If dwValue > "60" Then Resultmsg = Resultmsg & strMsg & "Invalid Value" & dwValue & VBCRLF & VBCRLF End If
  137. Else
  138.  Resultmsg = Resultmsg & strMsg & "Not Configured" & VBCRLF & VBCRLF
  139. End If
  140.  
  141.  
  142. Resultmsg = Resultmsg & "Windows Update Check" & VBCRLF & "Written By Eugene Grimsdell"
  143.  
  144. MsgBox Resultmsg,,strComputer
  145.  
  146. set oReg = nothing
  147.  
  148.  
  149. Function GetNoAutoUpdate(Index)
  150.  Select Case Index
  151.   Case 0 GetNoAutoUpdate = "0 - Auto Update applied by GPO"
  152.   Case 1 GetNoAutoUpdate = "1 - No Auto Update is applied by GPO"
  153.   Case Else GetNoAutoUpdate = "Invalid Entry"
  154.  End select
  155. End Function
  156.  
  157. Function GetUseWUServer(Index)
  158.  Select Case Index
  159.   Case 0 GetUseWUServer = "0 - Client is configured to receive updates from windowsupdate.microsoft.com"
  160.   Case 1 GetUseWUServer = "1 - Client is configured to receive updates from your WSUS Server"
  161.   Case Else GetUseWUServer = "Invalid Entry"
  162.  End select
  163. End Function
  164.  
  165. Function GetDay(Index)
  166.  Select Case Index
  167.   Case "0" GetDay = "Every Day"
  168.   Case "1" GetDay = "Every Sunday"
  169.   Case "2" GetDay = "Every Monday"
  170.   Case "3" GetDay = "Every Tuesday"
  171.   Case "4" GetDay = "Every Wednesday"
  172.   Case "5" GetDay = "Every Thursday"
  173.   Case "6" GetDay = "Every Friday"
  174.   Case "7" GetDay = "Every Saturday"
  175.   Case Else GetDay = "Invalid Entry"
  176.  End select
  177. End Function
  178.  
  179. Function GetAUOptions(Index)
  180.  Select Case Index
  181.   Case "0" GetAUOptions = "0"
  182.   Case "1" GetAUOptions = "1 - Deactivated in the Settings"
  183.   Case "2" GetAUOptions = "2 - Notify before download and Install."
  184.   Case "3" GetAUOptions = "3 - Autom. Download, notify before installation."
  185.   Case "4" GetAUOptions = "4 - Autom. Download, install according to GPO settings."
  186.   Case "5" GetAUOptions = "5 - Allow Local Administator installation and manual configuration."
  187.   case Else GetAUOptions = "Invalid Entry"
  188.  End select
  189. End Function
  190.  
  191. Function GetNoAUShutdownOption(Index)
  192.  Select Case Index
  193.   Case 0 GetNoAUShutdownOption = "0 - 'Updates are being installed and system will be restarted' user ill be notified"
  194.   Case 1 GetNoAUShutdownOption = "1 - 'Updates are being installed and system will be restarted' user will NOT be notified"
  195.   Case Else GetNoAUShutdownOption = "Invalid Entry"
  196.  End select
  197. End Function
  198.  
  199. Function GetAutoInstallMinorUpdates(Index)
  200.  Select Case Index
  201.   Case 0 GetAutoInstallMinorUpdates = "0 - Automatic updates are not immediately installed"
  202.   Case 1 GetAutoInstallMinorUpdates = "1 - Automatic updates are immediately installed"
  203.   Case Else GetAutoInstallMinorUpdates = "Invalid Entry"
  204.  End select
  205. End Function
  206.  
  207. Function GetNoAutoReboot(Index)
  208.  Select Case Index
  209.   Case "0" GetNoAutoReboot = "0 - User Countdown of 5 Minutes"
  210.   Case "1" GetNoAutoReboot = "1 - User will be notified before a system restart"
  211.   case Else GetNoAutoReboot = "Invalid Entry"
  212.  End select
  213. End Function
  214.  
  215. Function RegValueExists(sRegKey, sRegValue)
  216.   sRegKey = Trim(sRegKey)
  217.   sRegValue = LCase(Trim(sRegValue))
  218.   ' init value
  219.  RegValueExists = False
  220.   If oReg.EnumValues(HKLM, sRegKey, aValueNames, aValueTypes) = 0 Then
  221.     If Not IsNull(aValueNames) Then
  222.       For i = 0 To UBound(aValueNames)
  223.         If LCase(aValueNames(i)) = sRegValue Then
  224.           RegValueExists = True
  225.         End If
  226.       Next
  227.     End If
  228.   End If
  229. End Function
  230.  
  231. Function RegKeyExists(sRegKey)
  232.   sRegKey = Trim(sRegKey)
  233.   If oReg.EnumValues(HKLM, sRegKey, aValueNames, aValueTypes) = 0 Then
  234.     RegKeyExists = True
  235.   Else
  236.     RegKeyExists = False
  237.   End If
  238. End Function
Advertisement
Add Comment
Please, Sign In to add comment