![]() ![]() If you need to cross domain boundaries, you would need to supply additional information or use a slightly different programming model. Both your local and remote computers are within the same domain.This is essentially a Windows security requirement that you must have logged onto your system with a password. The password on your current local machine is not blank.For more information, see User Account Control and WMI. Due to User Account Control, the account on the remote system must be a domain account in the Administrators group. You are an administrator on the remote machine.Specifically, the samples assume the following: The previous code samples are arguably the most basic remote connection you can perform with WMI. _bstr_t(useNTLM?NULL:pszAuthority),// Authority _bstr_t(useToken?NULL:pszPwd), // User password _bstr_t(useToken?NULL:pszName), // User name Use the IWbemLocator::ConnectServer method to specify the name of the remote computer in the strNetworkResource parameter. ManagementObjectSearcher searcher = new ManagementObjectSearcher(scope, query) Įxample: Getting WMI Data from a Remote Computer (C ) ObjectQuery query = new ObjectQuery("SELECT * FROM Win32_OperatingSystem") ManagementScope scope = new ManagementScope("\\\\Computer_B\\root\\cimv2") ![]() IEnumerable queryInstance = mySession.QueryInstances(Namespace, "WQL", OSQuery) įor the v1 version of the WMI managed interface ( System.Management), use the ManagementScope object to represent a connection to a remote host. String Namespace = OSQuery = "SELECT * FROM Win32_OperatingSystem" ĬimSession mySession = CimSession.Create("Computer_B") Set colSettings = objWMIService.ExecQuery("Select * from Win32_OperatingSystem")įor the current version of the WMI managed interface ( ), use the CimSession object to represent a connection to a remote host. Set objWMIService = GetObject("winmgmts:!\\"
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |