Photo Gallery
Member List
Search
Calendars
FAQ
Ticket List
Log Out
Forums
Register
Login
My Profile
Inbox
Address Book
My Subscription
My Forums
Convert To Visual Basic
Logged in as: Guest
arrSession:exec spGetSession 2,7,48831
Active Users: There are
0
members and
0
guests.
Users viewing this topic: none
Printable Version
All Forums
>>
[General Forum]
>>
Other Programming/Scripting Languages
>> Convert To Visual Basic
Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page:
[1]
Login
Message
<< Older Topic
Newer Topic >>
Convert To Visual Basic -
6/27/2007 6:17:57 PM
l33tbot_if
Posts: 11
Score: 0
Joined: 6/25/2007
Status:
offline
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()
Post #: 1
RE: Convert To Visual Basic -
6/27/2007 6:46:12 PM
ginolard
Posts: 1024
Score: 21
Joined: 8/10/2005
Status:
offline
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
AD Query Template -
http://www.visualbasicscript.com/m_40609/tm.htm
Consolidated Scripting Framework -
http://www.visualbasicscript.com/m_59109/tm.htm
(in reply to
l33tbot_if
)
Post #: 2
If you found our site useful please link to us
<a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>
.
All Forums
>>
[General Forum]
>>
Other Programming/Scripting Languages
>> Convert To Visual Basic
Page:
[1]
Jump to:
Select a Forum
All Forums
----------------------
[Welcome]
- - Forum Rules
- - Test Posting Messages
- - New Member Area/Introduction
[Scripting]
- - WSH & Client Side VBScript
- - WSH & Client Side VBScript Tutorial
- - Post a VBScript
- - Windows PowerShell
- - ASP
- - ASP.NET
- - Windows Script Components
[General Forum]
- - Other Programming/Scripting Languages
- - Suggestions & Feedback
- - Off-Topic Lounge
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.5.5 ANSI