|
-
July 8th, 2008, 03:31 AM
#1
WMI Connection Error to remote machine
Hi - I'm trying to use WMI to query a remote machine and get process information. Locally my program worked great, but the remote connection gives me a ManagementException "user credentials cannot be used for local connections." Here is my code:
using System.Management;
//....
ManagementScope scope = new ManagementScope(new ManagementPath("\\\\xp-remote02"));
scope.Options.user = "mike";
scope.Options.Password= "tike";
scope.Options.Authentication= AuthenticationLevel.PacketPrivacy;
// Formulate the query - SELECT * FROM Win32_Process WHERE Name LIKE "%dev%"
ObjectQuery query = new ObjectQuery("SELECT * FROM Win32_Process WHERE Name LIKE \"%dev%\"");
//Execute the query
ManagementObjectSearcher searcher = new ManagementObjectSearcher(scope, query);
//Get the results
ManagementObjectCollection collection = searcher.Get();
//loop and write to console
foreach( ManagementObject mgt in collection)
{
Console.WriteLine(mgt["Name"].ToString());
}
//....
The error points to the row containing searcher.Get(). I'd really appreciate help on this one - thanks.
-
July 8th, 2008, 04:14 AM
#2
Re: WMI Connection Error to remote machine
Is it even possible to remote connect or am I just waiting my time? Why do I keep getting that error?...
-
July 8th, 2008, 06:39 AM
#3
Re: WMI Connection Error to remote machine
it is obvious in the error message that your computer has no admin rights (policy) to access remote computers' in your network area. checkout with your network admin, he should provide you with the right GPO
Busy 
-
July 11th, 2008, 03:34 AM
#4
Re: WMI Connection Error to remote machine
I have access to the remote machine via remote-desktop-connection (as simple user). Does that mean I can't access it with WMI unless I have admin privileges?
Last edited by sa125; July 11th, 2008 at 05:13 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|