Announcement

Collapse
No announcement yet.

Windows Updates and Server Core

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

  • Windows Updates and Server Core

    Does anyone know of a command to call Windows Updates on demand on server core? I only know of this command->
    cscript scregedit.wsf /AU /4
    to enable automatic updates that will download and install updates when they become available. I want to be able to initiate this process on my terms while I babysit the server in case something goes wrong like I do with other servers that run full installation.

  • #2
    Re: Windows Updates and Server Core

    Do you mean: Wuauclt /detectnow ?
    Marcel
    Technical Consultant
    Netherlands
    http://www.phetios.com
    http://blog.nessus.nl

    MCITP(EA, SA), MCSA/E 2003:Security, CCNA, SNAF, DCUCI, CCSA/E/E+ (R60), VCP4/5, NCDA, NCIE - SAN, NCIE - BR, EMCPE
    "No matter how secure, there is always the human factor."

    "Enjoy life today, tomorrow may never come."
    "If you're going through hell, keep going. ~Winston Churchill"

    Comment


    • #3
      Re: Windows Updates and Server Core

      Here is a great thing I found and I use it on all my core servers. Copy the following to notepad and save it as Update.vbs, put it on the c drive of your server and then simply type the following at the c prompt: cscript update.vbs

      It will go out and look for updates, show you what's there and ask if you want to run them now.

      Code:
      Set updateSession = CreateObject("Microsoft.Update.Session")
      Set updateSearcher = updateSession.CreateupdateSearcher()
      WScript.Echo "Searching for updates..." & vbCRLF
      Set searchResult = _
      updateSearcher.Search("IsInstalled=0 and Type='Software'")
      
      WScript.Echo "List of applicable items on the machine:"
      For I = 0 To searchResult.Updates.Count-1
          Set update = searchResult.Updates.Item(I)
          WScript.Echo I + 1 & "> " & update.Title
      Next
      If searchResult.Updates.Count = 0 Then
       WScript.Echo "There are no applicable updates."
       WScript.Quit
      End If
      WScript.Echo vbCRLF & "Creating collection of updates to download:"
      Set updatesToDownload = CreateObject("Microsoft.Update.UpdateColl")
      For I = 0 to searchResult.Updates.Count-1
          Set update = searchResult.Updates.Item(I)
          WScript.Echo I + 1 & "> adding: " & update.Title 
          updatesToDownload.Add(update)
      Next
      WScript.Echo vbCRLF & "Downloading updates..."
      Set downloader = updateSession.CreateUpdateDownloader() 
      downloader.Updates = updatesToDownload
      downloader.Download()
      WScript.Echo  vbCRLF & "List of downloaded updates:"
      For I = 0 To searchResult.Updates.Count-1
          Set update = searchResult.Updates.Item(I)
          If update.IsDownloaded Then
             WScript.Echo I + 1 & "> " & update.Title 
          End If
      Next
      Set updatesToInstall = CreateObject("Microsoft.Update.UpdateColl")
      WScript.Echo  vbCRLF & _
      "Creating collection of downloaded updates to install:" 
      For I = 0 To searchResult.Updates.Count-1
          set update = searchResult.Updates.Item(I)
          If update.IsDownloaded = true Then
             WScript.Echo I + 1 & "> adding:  " & update.Title 
             updatesToInstall.Add(update) 
          End If
      Next
      WScript.Echo  vbCRLF & "Would you like to install updates now? (Y/N)"
      strInput = WScript.StdIn.Readline
      WScript.Echo 
      If (strInput = "N" or strInput = "n") Then 
       WScript.Quit
      ElseIf (strInput = "Y" or strInput = "y") Then
       WScript.Echo "Installing updates..."
       Set installer = updateSession.CreateUpdateInstaller()
       installer.Updates = updatesToInstall
       Set installationResult = installer.Install()
       
       'Output results of install
       WScript.Echo "Installation Result: " & _
       installationResult.ResultCode 
       WScript.Echo "Reboot Required: " & _ 
       installationResult.RebootRequired & vbCRLF 
       WScript.Echo "Listing of updates installed " & _
        "and individual installation results:" 
       
       For I = 0 to updatesToInstall.Count - 1
        WScript.Echo I + 1 & "> " & _
        updatesToInstall.Item(i).Title & _
        ": " & installationResult.GetUpdateResult(i).ResultCode   
       Next
      End If
      Last edited by biggles77; 12th February 2009, 19:08. Reason: Add code wrap

      Comment


      • #4
        Re: Windows Updates and Server Core

        Did you write this script yourself? If not can you post some attributing information?

        Also I have asked Rems (our scripting Guru) to sign off what this script does - just in case


        Tom
        For my own and your protection, I do not provide support by private message under any circumstances. All such messages will be deleted and ignored.

        Anything you say will be misquoted and used against you

        Comment


        • #5
          Re: Windows Updates and Server Core

          Sorry, was in a hurry and couldn't really remember where I got it. You can find it here.

          http://msdn.microsoft.com/en-us/libr...02(VS.85).aspx

          Comment

          Working...
          X