Quantcast
Channel: Ivanti User Community: Message List
Viewing all articles
Browse latest Browse all 12704

Re: Set-up a Query

$
0
0

I do this in a 2 step process.  First I have a vbs script that will determine the status of autoupdate.  Its not a simple on or off.  And the location of the registry value controlling it depends on if it is set manually or is controlled by a group policy.

I write the result to a registry key and then I have LANDesk collect that data (using custom data in Manage Software List).

 

Here is the VBS script:

 

Dim str, strKeyPath1, strKeyPath2, strOptionName, arrOptions
strKeyPath1 = "HKLM\Software\Policies\Microsoft\Windows\WindowsUpdate\AU\"
strKeyPath2 = "HKLM\Software\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\"
strOptionName = "AUOptions"
arrOptions = array("Unknown", "Turn off", "Notify but do not download", "Download but do not install", "Automatic")

str = ReadFromRegistry(strKeyPath1 & strOptionName, "0")
'WScript.echo "WSUS AU: " & arrOptions(CInt(str))

If str = "0" Then
str = ReadFromRegistry(strKeyPath2 & strOptionName, "0")
WriteReg "HKLM\Software\Huit\WinUpdates\AutoUpdate",arrOptions(CInt(str))
' WScript.echo "Auto Updates: " & arrOptions(CInt(str))
Else
WriteReg "HKLM\Software\Huit\WinUpdates\AutoUpdate",arrOptions(CInt(str)) & " (WSUS)"
End If

Function ReadFromRegistry (strRegistryKey, strDefault)
Dim WSHShell, value
    On Error Resume Next
    Set WSHShell = CreateObject("WScript.Shell")
    value = WSHShell.RegRead(strRegistryKey)
    if err.number <> 0 then
        ReadFromRegistry = strDefault
    else
        ReadFromRegistry = value
    end if
    set WSHShell = nothing
End Function

Sub WriteReg(strKeyPath,strValue)
  Dim WshShell, bKey
  Set WshShell = WScript.CreateObject("WScript.Shell")
  WshShell.RegWrite strKeyPath, strValue, "REG_SZ"
  Set wshShell = Nothing
End Sub


Viewing all articles
Browse latest Browse all 12704

Trending Articles