myITforum.com Community Forum myITforum.com Community Forum

Home  Forums  Blogs  Live Support chat  Search Articles  Wiki  FAQ  Email Lists  Register  Login  My Profile  Inbox  Address Book  My Subscription  My Forums 

Photo Gallery  Member List  Search  Calendars  FAQ  Ticket List  Log Out

All Forums RSS Feed Subscription:


  


install script

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
  Printable Version
All Forums >> [Scripting Technologies] >> VB Script >> install script Page: [1]
Login
Message << Older Topic   Newer Topic >>
install script - 4/7/2008 9:11:56 AM   
claudele

 

Posts: 3
Score: 0
Joined: 4/4/2008
Status: offline
claudele
I have a script that is suppose to run automatic updates from the local wsuscab and install the updates from that cab on a local file server. It  scans and downloads the updates but doesn't install, giving error number 4. In windows update log it reads Windows failed to install the following update with error 0x80246007:
thanks for any help.
Script is

Set UpdateSession = CreateObject("Microsoft.Update.Session")
Set UpdateServiceManager = CreateObject("Microsoft.Update.ServiceManager")
Set UpdateService = UpdateServiceManager.AddScanPackageService("Offline Sync Service", "c:\wsusscn2.cab")
Set UpdateSearcher = UpdateSession.CreateUpdateSearcher()
'Set updatesToInstall = CreateObject("Microsoft.Update.UpdateColl")
WScript.Echo "Searching for updates..." & vbCRLF
UpdateSearcher.ServerSelection = 3
UpdateSearcher.ServiceID = UpdateService.ServiceID
Set SearchResult = UpdateSearcher.Search("IsInstalled=0")
Set Updates = SearchResult.Updates
If searchResult.Updates.Count = 0 Then
  WScript.Echo "There are no applicable updates."
  WScript.Quit
End If

'20
WScript.Echo "List of applicable items on the machine when using wssuscan.cab:" & vbCRLF
'*******************************************************************************
WScript.Echo vbCRLF & "Downloading updates..."

'*******************************************************************************
Set updatesToInstall = 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
     updatesToInstall.Add(update) 
 
Next
'WScript.Echo "List of updates:" & updatesToInstall
'******************************************************************************
'39
WScript.Echo "Installing updates..."
Set installer = updateSession.CreateUpdateInstaller()
installer.Updates = updatesToInstall
      Set installationResult = installer.Install()
Wscript.echo " Close 2" 
For I = 0 to updatesToInstall.Count - 1
WScript.Echo I + 1 & "> " & _
updatesToInstall.Item(i).Title & _
": " & installationResult.GetUpdateResult(i).ResultCode
Next
'Output results of install
WScript.Echo "Installation Result: " & installationResult.ResultCode
WScript.Echo "Reboot Required: " & installationResult.RebootRequired & vbCRLF    

WScript.Quit
Post #: 1
RE: install script - 4/7/2008 10:23:07 AM   
rtruss


Posts: 245
Score: 11
Joined: 11/4/2004
Status: offline
Not sure what to tell you.  I just tested your script and after changing the &amp; to just & it worked flawlessly.  Mind you my systems was vista and it is fully patched so nothing was needed.

(in reply to claudele)
Post #: 2
RE: install script - 4/7/2008 11:50:02 AM   
claudele

 

Posts: 3
Score: 0
Joined: 4/4/2008
Status: offline
Its running on XP that needs 2 updates from the cab and it is not installing. It runs without errors but its not executing installation. Thanks for the feedback rtruss

(in reply to rtruss)
Post #: 3
RE: install script - 4/24/2008 11:11:41 AM   
charlesanh

 

Posts: 1
Score: 0
Joined: 4/24/2008
Status: offline
Claudele, did you every figured it out.  I am having the saving issues.  I can't install after the scan when working offline.  I was able to do this to trick the script.  I got online with network laptop and downloaded the update i needed.  I moved that update to the download folder under SoftwareDistribution on my offline laptop.  I ran a similiar script to yours and it got install.  The question I have is why I can scan the local wsusscn2.cab to verify which updates is needed but can't install.  Does this not work on an offline machine. 
Set installer = updateSession.CreateUpdateInstaller()
installer.Updates = updatesToInstall 
Set installationResult = installer.Install()

Thanks for any help,
ATD

(in reply to claudele)
Post #: 4
Page:   [1]
All Forums >> [Scripting Technologies] >> VB Script >> install script Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts



  
Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI

0.219