Imports System
Imports System.Management
Public Class RemoteConnect
Public Overloads Shared Function Main(ByVal args() As String) As Integer
Dim options As ConnectionOptions
options = New ConnectionOptions
Dim scope As ManagementScope
scope = New ManagementScope("\\FullComputerName\root\cimv2", options)
scope.Connect()
Dim query As ObjectQuery
query = New ObjectQuery("SELECT * FROM Win32_OperatingSystem")
Dim searcher As ManagementObjectSearcher
searcher = New ManagementObjectSearcher(scope, query)
Dim queryCollection As ManagementObjectCollection
queryCollection = searcher.Get()
Dim m As ManagementObject
For Each m In queryCollection
Console.WriteLine("Computer Name : {0}",m("csname"))
Console.WriteLine("Windows Directory : {0}",m("WindowsDirectory"))
Console.WriteLine("Operating System: {0}",m("Caption"))
Console.WriteLine("Version: {0}", m("Version"))
Console.WriteLine("Manufacturer : {0}",m("Manufacturer"))
Next
Return 0
End Function
End Class
|