l33tbot_if
-
Total Posts
:
11
- Scores: 0
-
Reward points
:
0
- Joined: 6/25/2007
-
Status: offline
|
Convert To Visual Basic
Wednesday, June 27, 2007 7:17 PM
( permalink)
Hey guys do you have any idea to convert the following script to visual basic, i have tried by add some item like DIM, Console.Writeln And there is no error in syntax but when i run this program I got some exception Here is the code
Set us = CreateObject("Microsoft.Update.Session")
Set updates = CreateObject("Microsoft.Update.UpdateColl","IP")
updateTitle = "Security Updates for Windows 2000 (KB914388)"
Set download = us.CreateUpdateDownloader()
Set usearch = us.CreateupdateSearcher()
Set usresult = usearch.Search("IsInstalled=0 Or IsInstalled=1 and Type='Software'")
For a = 0 to usresult.Updates.Count - 1
Set patch = usresult.Updates.Item(a)
if UCase(updateTitle) = UCase(patch.Title) Then
updates.Add(patch)
End If
Next
download.Updates = updates
download.Download()
|
|
|
|
ginolard
-
Total Posts
:
1347
- Scores: 23
-
Reward points
:
0
- Joined: 8/11/2005
-
Status: offline
|
RE: Convert To Visual Basic
Wednesday, June 27, 2007 7:46 PM
( permalink)
This is untested but, even if it doesn't work, should get you started. You'll need to add a reference to WUAPILIB. Oh and this is VB.Net 2005
Dim Us As New WUApiLib.UpdateSession
Dim Updates As New WUApiLib.UpdateCollection
Dim UpdatesTitle As String = "Security Updates for Windows 2000 (KB914388)"
Dim download As New WUApiLib.UpdateDownloader
Dim usearch As New WUApiLib.UpdateSearcher
Dim usresult As WUApiLib.ISearchResult = usearch.Search("IsInstalled=0 Or IsInstalled=1 and Type='Software'")
For a As Integer = 0 To usresult.Updates.Count
Dim patch As WUApiLib.IUpdate = usresult.Updates.Item(a)
If UpdatesTitle.ToUpper = patch.Title.ToUpper Then
Updates.Add(patch)
End If
Next
download.Updates = Updates
download.Download()
Mods - can you move this post into the "Other languages" forum please?
|
|
|
|