On-demand patching in SCCM (Full Version)

All Forums >> [Management Products] >> System Center Products >> System Center Configuration Manager



Message


rdiekhoff -> On-demand patching in SCCM (9/11/2008 1:25:51 PM)

Does anyone have a solution for SCCM similar to the one described here (http://www.myitforum.com/articles/8/view.asp?id=8909) for SMS 2003?  

Thanks!
Rhonda




hcortez463 -> RE: On-demand patching in SCCM (9/11/2008 1:36:02 PM)

on demand intall? 




rdiekhoff -> RE: On-demand patching in SCCM (9/11/2008 1:39:59 PM)

Yes, on-demand installation of patches.  In SMS 2003, we currently deploy patches to all systems via advertisements using the ITMU tools, but we also allow the users to install patches on-demand using the script that is listed in my origianl post.  We're preparing to upgrade to SCCM 2007 and I was wondering if there is a similar script or method of allowing users to install patching on-demand from the SCCM SUPs.

Rhonda




hcortez463 -> RE: On-demand patching in SCCM (9/11/2008 1:58:11 PM)

In ITMU do you make the patches manditory?




rdiekhoff -> RE: On-demand patching in SCCM (9/11/2008 2:03:14 PM)

Yes, we do but we still like to give the users the opportunity to install them on-demand.  We also use the script I referred to during the installation of new PCs (we don't use OSD - we have an in-house solution for PC provisioning).




hcortez463 -> RE: On-demand patching in SCCM (9/11/2008 2:07:01 PM)

i see.. im sorry if im missunderstanding you but in SCCM you can allow the user to install apps any time or schedule.. Check out these examplese by John. 

http://www.myitforum.com/articles/20/view.asp?id=11241

http://www.myitforum.com/articles/20/view.asp?id=11242




ssign -> RE: On-demand patching in SCCM (9/11/2008 3:35:18 PM)

 (http://www.myitforum.com/articles/8/view.asp?id=8909)

I downloaded and changed the ServerName and File location in the .cmd file and didn't have to do anything to the vbscript. It worked the first time! I was trying to do this on my own yesterday and I thank the creator becuase I didn't even come close!

*Note* I am running SMS 2003, I have already created my patch collection using sms. I put the files in the root of the folder containing all my patches. I have computers that are not reachable by our SiteServer. Now I can run the same updates on these standalone computers.




rdiekhoff -> RE: On-demand patching in SCCM (9/12/2008 8:39:19 AM)

Thanks for the examples hcortez463 - those documents will probably come in handy while trying to show others what options we have, and will keep me from having to create these from scratch. 
 
However, I'm still hoping that someone has a similar solution for SCCM as what was posted for SMS 2003 at http://www.myitforum.com/articles/8/view.asp?id=8909)   This script works great in SMS 2003 and it would be fantastic if we had one like it in SCCM.  If anyone knows of a solution to allow users to install patches from an SCCM SUP "on-demand", please consider sharing it!  THANKS!
 
 




wbracken -> RE: On-demand patching in SCCM (9/12/2008 12:34:44 PM)

I think you may mean something like this?  The attached code will download if needed and install any approved patches.  Since SCCM uses WSUS it should work the same.  this runs silently and forces a reboot if needed but you could modify as needed.

on error resume next
'######################################################################
'# Initialize
'######################################################################
Const FORCEDRESTART = 6
Const HKEY_LOCAL_MACHINE = &H80000002
Dim updateSession, updateSearcher, updatesToDownload, updatesToInstall
Dim objReg, strKeyPath, strValueName, regWSUSServer
Dim updateServerIsOnline
Dim objHttpRequest
Dim searchResult
Dim update
Dim downloader
Dim I
Dim installer
Dim installationResult
Dim computerName
Dim objShell, objWMIService, colOperatingSystems, objOperatingSystem,objnetwork
Dim strEventText
Dim EmailAddresses
Dim EmailMessage
computerName = "."
strEventText = ""
Set updateSession = CreateObject("Microsoft.Update.Session")
Set updateSearcher = updateSession.CreateupdateSearcher()
Set updatesToDownload = CreateObject("Microsoft.Update.UpdateColl")
Set updatesToInstall = CreateObject("Microsoft.Update.UpdateColl")
Set objShell = Wscript.CreateObject("Wscript.Shell")
set objnetwork=wscript.createobject("wscript.network")
'######################################################################
'#Begin Installation Process
'######################################################################
objShell.LogEvent 4, "WUSUS has been initiated."

'######################################################################
'# Verify the availability of our Updates server (i.e. WSUS or Windows Update)
'######################################################################
Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
 computerName & "\root\default:StdRegProv")
strKeyPath = "SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate"
strValueName = "WUServer"
objReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,regWSUSServer

Set objHttpRequest = CreateObject("Msxml2.XMLHTTP")
objHttpRequest.open "HEAD", regWSUSServer, False

objHttpRequest.send
If Err.Number <> 0 Then
 updateServerIsOnline = false
 objShell.LogEvent 2, "The WSUS Server, " & regWSUSServer &_
 " is not available, Terminating forced install."
 wscript.quit
Else
 updateServerIsOnline = true
End If

'######################################################################
'# Search for available updates and notify the Application Event Log
'######################################################################
updateSearcher.Online = updateServerIsOnline
Set searchResult = _
updateSearcher.Search("IsInstalled=0 and IsAssigned=1")
If searchResult.Updates.Count = 0 Then
 ' There are no applicable updates
 objShell.LogEvent 2, "No updates to install. Script terminated."
 
 
 WScript.Quit
End If
strEventText = "The following updates will be installed:" & vbCRLF
For I = 0 To searchResult.Updates.Count-1
    Set update = searchResult.Updates.Item(I)
    strEventText = strEventText & vbTab & I + 1 & "> " & update.Title & vbCRLF
Next

strEventText = strEventText & vbCRLF & "Proceeding with download and installation...." & vbCRLF
objShell.LogEvent 4, strEventText
'######################################################################
'# Search for updates that still need to be downloaded and download them
'######################################################################
If updateServerIsOnline Then 'Check to make sure we are in online mode first

 Set updatesToDownload = CreateObject("Microsoft.Update.UpdateColl")
 strEventText = "Downloading the following updates:" & vbCRLF
 For I = 0 to searchResult.Updates.Count-1
     Set update = searchResult.Updates.Item(I)
     If update.IsDownloaded = False Then
  strEventText = strEventText & vbCRLF & I + 1 & "> " & update.Title 
  updatesToDownload.Add(update)
     End If
 Next
 If updatesToDownload.Count < 1 Then
  'Do Nothing
 Else
  objShell.LogEvent 4, strEventText
  Set downloader = updateSession.CreateUpdateDownloader() 
  downloader.Updates = updatesToDownload
  downloader.Download()
 End If
End If
'######################################################################
'# Create 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
       updatesToInstall.Add(update) 
    End If
Next
'######################################################################
'# Install updates
'######################################################################
Set installer = updateSession.CreateUpdateInstaller()
installer.Updates = updatesToInstall
Set installationResult = installer.Install()

For I = 0 To searchResult.Updates.Count-1
    Set update = searchResult.Updates.Item(I)
Next
If installationResult.RebootRequired = true Then
 objShell.LogEvent 4, "Completed the installation of updates.  Restarting Windows..."
 
 'Open a WMIService connection to the local machine
 Set objWMIService = GetObject("winmgmts:" _
     & "{impersonationLevel=impersonate,(Shutdown)}!\\" & _
  computerName & "\root\cimv2")
 'Obtain the local OS Collection
 Set colOperatingSystems = objWMIService.ExecQuery _
     ("Select * from Win32_OperatingSystem")
 'Use the Win32Shutdown method to force the restart
 For Each objOperatingSystem in colOperatingSystems
     objOperatingSystem.Win32Shutdown(FORCEDRESTART)
 Next
Else
 objShell.LogEvent 4, "Completed the installation of updates.  No restart is required."
 
 
End If






rdiekhoff -> RE: On-demand patching in SCCM (9/16/2008 8:03:46 AM)

Thanks wbracken.  I will see if I can get this to work for us!

Rhonda




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.28125