Convert To Visual Basic

Author Message
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)
0
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() 
   

 
#1
    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)
    0
    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?
    Author of ManagePC - http://managepc.net

     
    #2

      Online Bookmarks Sharing: Share/Bookmark

      Jump to:

      Current active users

      There are 0 members and 1 guests.

      Icon Legend and Permission

      • 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
      • Read Message
      • Post New Thread
      • Reply to message
      • Post New Poll
      • Submit Vote
      • Post reward post
      • Delete my own posts
      • Delete my own threads
      • Rate post

      2000-2012 ASPPlayground.NET Forum Version 3.9