The Windows Management Instrumentation (WMI) service runs on all Windows computers. You can use this service to invoke software and instructions on the computer. You can also use the WMI service to invoke a service on a remote computer. You must log in to the remote computer from the VB.NET application code. This is beneficial for programmers creating network administration applications.
- Skill level:
Other People Are Reading
Click the Windows "Start" button and select "All Programs." Click "Microsoft .NET Framework," then click "Visual Studio" to open your programming software.
Click the "File" menu item when Visual Studio loads. Click "Open." Double-click your project file to open your VB.NET project.
Right-click the form in the panel labelled "Solution Explorer." Select "View Code" to open the code file where you type your code to invoke the service on the remote computer.
Type the following code into your project file:
Dim connection As New System.Management.ConnectionOptions
computer = New System.Management.ManagementScope("\computername\root\cimv2", connection)
service = New System.Management.ManagementObjectSearcher(connection.Path.ToString, "Select servicename From Win32_Product")
Replace "computername" with the name of the remote computer to which you want to connect. Replace "servicename" with the name of the service you want to run.
Click the "Save" button at the top of your Visual Studio window. To test your new code, click the "Run" button in the toolbar to execute the code.
- 20 of the funniest online reviews ever
- 14 Biggest lies people tell in online dating sites
- Hilarious things Google thinks you're trying to search for