Migrating VBS Scheduled Task to VB.NET
Posted on 2004-09-20
Here's what I'm trying to do. We've got a series of tasks that run on our servers at a given time interval. Right now all these scheduled tasks are just vbScript files that are parsed by the Windows Scripting Host. This solution has been working for a while, but I'd like to migrate a few of them to VB.NET and compile them into .exe's.
I've had pretty good luck converting some of the simple ones over (ones that just read or write to a database, or copy files to a backup server).
With the file I'm currently trying to migrate, I'm having trouble with the old "CreateObject()" syntax. This particular object is an instance of an object defined in a .dll that is registered on the server. In vbScript it was a simple 'Set objWhatever = CreateObject("Whatever")', however, .NET doesn't do Set and Let anymore, so my syntax is something like 'Dim objWhatever AS NEW Whatever". <--- This isn't working.
I'm guessing that I have to reference the class of the object with some fully qualified name (including the namespace or something), but I haven't figured out just how to do it.
Please note, I am not using Visual Studio. I'm coding by hand (in a text editor) and compiling on the command line.
Any expert input would be appreciated.