Can anyone tell me what is wrong with the block of code below:
I keep getting an invalid namespace error and I don't have the foggiest idea why. Any help would be appreciated.Code:Private Sub GetPCInfo(ByVal PCName As String) Dim queryOS As New SelectQuery("Win32_OperatingSystem") Dim queryCS As New SelectQuery("Win32_ComputerSystem") Dim myConnectionOptions As New System.Management.ConnectionOptions With myConnectionOptions .Impersonation = System.Management.ImpersonationLevel.Impersonate '* Use next line for XP .Authentication = System.Management.AuthenticationLevel.Packet '* Use next line for Win prior XP '*.Authentication = System.Management.AuthenticationLevel.Connect End With Dim oScope As New ManagementScope("\\" & PCName & "\root\cmvi2", myConnectionOptions) Dim searchOS As New ManagementObjectSearcher(oScope, queryOS) Dim searchCS As New ManagementObjectSearcher(oScope, queryCS) Dim info As ManagementObject oScope.Connect() If oScope.IsConnected = False Then lblStatus.Text = "You are not connected to the remote computer...please try again." Exit Sub End If For Each info In searchOS.Get() lblOSNameValue.Text = info("name") lblMachineNameValue.Text = info("csname") Next For Each info In searchCS.Get() lblMemoryValue.Text = info("totalphysicalmemory") lblManufacturerValue.Text = info("manufacturer") lblServerTypeValue.Text = info("systemtype") lblServerModelValue.Text = info("model") Next End Sub
Thanks,
Jim P.




Reply With Quote