Invoke a command using VB.Net and WMI

      No Comments on Invoke a command using VB.Net and WMI

Hi Again,

I’ve been looking into different ways of invoking commands on remote machines. Here’s one that can be used in VB.NET by using WMI.

First add a reference to System.Management and reference it at the start of your project:

Then add the guts, the code that calls WMI on the remote machine to open the process:

This will launch the process under the credentials of the user that ran the command. I tried to play around with impersonation but haven’t had much luck. In fact I chose to go down another route to launch my remote process as I had no luck with impersonation.

If any of you have had success using impersonation, or know another method to invoke a command as another user (using VB/C# .NET) let us know!

Leave a Reply

Your email address will not be published. Required fields are marked *