Announcement

Collapse
No announcement yet.

wuauclt /Detectnow Tool

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • wuauclt /Detectnow Tool

    I am trying to create a tool to initiate Windows Update detection on a remote computer. Using psexec this works with a hard coded computer. What variable would I use in place of \"Computername" to use the selected computer in the Hyena Window?

    psexec.exe \\Computername wuauclt.exe /detctnow

  • #2
    Re: wuauclt /Detectnow Tool

    You need to pass the %E% variable that's produced from Hyena.

    You also need to ensure that the "wuauclt.exe" is in the remote computer's PATH statement, otherwise PSEXEC won't be able to find and run it.

    Plus, if you happened to be in the same situation as I was, and had clients that wouldn't update for some unknown reason, try running this script against the system:

    '------- Start Here ----------
    Dim objProcess, objCalc
    Dim strShell, objProgram, strExe

    '' Connect to WMI
    set objWMIService = getobject("winmgmts://" & strComputer & "/root/cimv2")

    ' Obtain the Win32_Process class of object.
    Set objProcess = objWMIService.Get("Win32_Process")
    Set objProgram = objProcess.Methods_("Create").InParameters.SpawnIn stance_

    strExe = "regsvr32 /s wuapi.dll"
    objProgram.CommandLine = strExe
    'Execute the program now at the command line.
    Set strShell = objWMIService.ExecMethod("Win32_Process", "Create", objProgram)

    strExe = "regsvr32 /s wuaueng.dll"
    objProgram.CommandLine = strExe
    'Execute the program now at the command line.
    Set strShell = objWMIService.ExecMethod("Win32_Process", "Create", objProgram)

    strExe = "regsvr32 /s wuaueng1.dll"
    objProgram.CommandLine = strExe
    'Execute the program now at the command line.
    Set strShell = objWMIService.ExecMethod("Win32_Process", "Create", objProgram)

    strExe = "regsvr32 /s wucltui.dll"
    objProgram.CommandLine = strExe
    'Execute the program now at the command line.
    Set strShell = objWMIService.ExecMethod("Win32_Process", "Create", objProgram)

    strExe = "regsvr32 /s wups.dll"
    objProgram.CommandLine = strExe
    'Execute the program now at the command line.
    Set strShell = objWMIService.ExecMethod("Win32_Process", "Create", objProgram)

    strExe = "regsvr32 /s wups2.dll"
    objProgram.CommandLine = strExe
    'Execute the program now at the command line.
    Set strShell = objWMIService.ExecMethod("Win32_Process", "Create", objProgram)

    strExe = "regsvr32 /s wuweb.dll"
    objProgram.CommandLine = strExe
    'Execute the program now at the command line.
    Set strShell = objWMIService.ExecMethod("Win32_Process", "Create", objProgram)

    strExe = "wuauclt.exe /detectnow"
    objProgram.CommandLine = strExe
    'Execute the program now at the command line.
    Set strShell = objWMIService.ExecMethod("Win32_Process", "Create", objProgram)

    Wscript.Quit
    '------ End Here -----------

    This will re-register all the required DLLs for WU to run correctly, and then run the "wuauclt.exe /detectnow". It's worked on all the systems I've tried it on.

    To set this up as a tool, copy the text above (between Start and End) and save to a vbs file. Then call the vbs from a tool in Hyena, again, passing the %E% variable after the script. Oh, and tool command line should look like this:

    wscript.exe \\server\shares\Hyena\Scripts\WUFIX.vbs //I //NoLogo %E%

    Hope this helps!

    Joel

    Comment


    • #3
      Re: wuauclt /Detectnow Tool

      Just what I was looking for thanks. Was this documented someplace I didn't look?

      Comment


      • #4
        Re: wuauclt /Detectnow Tool

        I don't remember the link, but an M$ article had the REGSVR commands and the WMI stuff is documented under M$'s Scripting page.

        Pieced it together, and wha-lah!

        Glad it helped!

        Joel

        Comment


        • #5
          Re: wuauclt /Detectnow Tool

          It's hard to compete with the Supply Guy, lord knows he has given me the majority of my tools. The man is a God send. I picked up a force SUS update from one of the SUS web site forums. It works on SUS but not sure about WSUS. I will cross that bridge when I get to it.

          <span style="font-weight: bold">command line in Hyena</span>
          \\servershare\scripts\HyenaTools\Pstools\psexec.ex e \\%E% -u domainname\username -p password -c -f "\\servershare\Scripts\HyenaTools\Scripts\msusforc e.bat"

          <span style="font-weight: bold">msusforce.bat</span>
          @ECHO OFF
          ECHO Running SUS Force Update

          COPY "\\servershare\Scripts\Hyenatools\susforce\config. ini" "%windir%\temp\config.ini"
          COPY "\\servershare\Scripts\Hyenatools\susforce\msusfor ce.exe" "%windir%\temp\msusforce.exe"
          COPY "\\servershare\Scripts\Hyenatools\susforce\msusfor ce.wbt" "%windir%\temp\msusforce.wbt"
          COPY "\\servershare\Scripts\Hyenatools\susforce\wbdcg34 i.dll" "%windir%\temp\wbdcg34i.dll"
          COPY "\\servershare\Scripts\Hyenatools\susforce\wwwnt34 i.dll" "%windir%\temp\wwwnt34i.dll"
          COPY "\\servershare\Scripts\Hyenatools\susforce\readme. txt" "%windir%\temp\readme.txt"
          %windir%\temp\msusforce.exe /force

          TYPE %windir%\temp\sus-status.log
          pause

          <span style="font-weight: bold">Download files here</span>
          http://www.othclan.net/uploads/susforce.rar

          [This message has been edited by Trammel (edited 09-26-2005).]

          Comment


          • #6
            Re: wuauclt /Detectnow Tool

            Is this being used with WSUS? I also still have clients that have not shown up in WSUS admin.

            Comment


            • #7
              Re: wuauclt /Detectnow Tool

              Trammel...flattery will get you everywhere in life...

              Thanks for the kudos.

              As for working between SUS and WSUS, the script I put out there is for Windows Update (not SUS/WSUS specific). And I'm sure most are aware, the new WSUS requires a new client software to be loaded. So, you're best route for clients not showing up yet in WSUS, is to ensure you're registry settings are correct (and/or that Group Policy is being applied appropriately), then run the script. At the end of the script, you may also want to stop and restart the Windows Update service.

              Hope this helps!

              Joel

              Comment


              • #8
                Re: wuauclt /Detectnow Tool

                Makes sense, I am getting an error when trying to run this script at the moment and I can't see what I am doing wrong.

                The message is:
                Script: \\server\share\hyena\scripts\WUFIX.vbs
                Line: 5
                Char: 1
                Error: 0x80041021
                Code: 80041021
                Source: (null)

                Any ideas?

                Thanks,
                Karl

                Comment


                • #9
                  Re: wuauclt /Detectnow Tool

                  Karl,

                  The null error your getting is the WMI connector not knowing what system to connect to.

                  Your script isn't getting the 'strComputer' variable passed to it.

                  I guess I should have included that portion at the beginning.

                  Insert this as the first line:

                  strComputer = UCASE(Trim(WScript.Arguments(0)))

                  Then call this tool as you would any other in Hyena.

                  Hope this helps!!

                  Joel

                  Comment

                  Working...
                  X