res2cpu Posted April 24, 2009 Share Posted April 24, 2009 HiI'm a beginner when it comes to this stuff.I'm messing with the windows update agent and im having problems getting info from it.My code can get the list of updates but i can get the Download URL's from it.Heres my code so far:CODE#RequireAdmin$UpdateSession = ObjCreate("Microsoft.Update.Session")$UpdateSearcher = $UpdateSession.CreateUpdateSearcher()MsgBox(4096, "Test", "Searching for updates..." )$SearchResult = $UpdateSearcher.Search("IsInstalled=1")$Updates = $SearchResult.UpdatesIf $searchResult.Updates.Count = 0 Then MsgBox(4096, "Test", "None" ) ExitEndIfFor $I = 0 to $searchResult.Updates.Count - 1 $update = $searchResult.Updates.Item($I) MsgBox(4096, "Test", $I + 1 & "> " & $update.Title )Next$UpdateSearcher = $UpdateSession.CreateUpdateSearcher()$updatesToDownload = ObjCreate("Microsoft.Update.UpdateColl")For $I = 0 to $searchResult.Updates.Count - 1 $update = $searchResult.Updates.Item($I) $updatesToDownload.Add($update) MsgBox(4096, "Test", "Added: " & $update.Download.Content.DownloadUrl)NextMsgBox(4096, "Test", "Done" )ExitThe link to the windows update agent site with the info is: http://msdn.microsoft.com/en-us/library/aa387099(VS.85).aspx and the link to the item im trying to get working is here: http://msdn.microsoft.com/en-us/library/aa386129(VS.85).aspxI have googled for hours, thanks for any help you can give. Link to comment Share on other sites More sharing options...
DaleHohm Posted April 24, 2009 Share Posted April 24, 2009 It is not clear what your problem is. What is your question? Dale Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Link to comment Share on other sites More sharing options...
res2cpu Posted April 24, 2009 Author Share Posted April 24, 2009 Im trying to get the program to give me the url's for the windows updates so i can download them and install them at another time. This can be done (or so it says) using the API of the windows update agent. As soon as i add what i think is needed to get it to give me the download url the program closes itself (even in scite) with no error message. If i us the following: CODEFor $I = 0 to $searchResult.Updates.Count - 1 $update = $searchResult.Updates.Item($I) MsgBox(4096, "Test", $I + 1 & "> " & $update.Title ) MsgBox(4096, "Test", $I + 1 & "> " & $update.Download.Content.DownloadUrl ); <---------- New line Next The program closes with no error and does not run to the end. I think its something to do with the syntax of the "$update.Download.Content.DownloadUrl" but i cant find any examples in other languages. Hope this makes it clearer what im trying to do. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now