S
Stefan Pilgrim
Hi,
I try to query the Logins on a remote computer with a little c#-program.
Everything works fine, but some Logins are not returned from the remote
computer. Microsoft confirms that there's a problem with the
Win32_NetworkLoginProfile class.
http://support.microsoft.com/default.aspx?scid=kb;DE;816485
To solve the problem Microsoft recommends to use the following line in
VBScript:
Set objWbemServices = GetObject("winmgmts:{impersonationLevel=impersonate,
(Restore)}!root/cimv2")
That works fine. But I don't know how to bring the "(Restore)" to my
c#-program:
ManagementObjectSearcher searcher = new ManagementObjectSearcher(new
SelectQuery("SELECT * FROM Win32_NetworkLoginProfile"));
ConnectionOptions con= new ConnectionOptions();
con.Impersonation = ImpersonationLevel.Impersonate;
ManagementScope mScope = new ManagementScope("\\\\BS457\\root\\cimv2", con);
searcher.Scope = mScope;
searcher.Get(results);
Thanks
Stefan
I try to query the Logins on a remote computer with a little c#-program.
Everything works fine, but some Logins are not returned from the remote
computer. Microsoft confirms that there's a problem with the
Win32_NetworkLoginProfile class.
http://support.microsoft.com/default.aspx?scid=kb;DE;816485
To solve the problem Microsoft recommends to use the following line in
VBScript:
Set objWbemServices = GetObject("winmgmts:{impersonationLevel=impersonate,
(Restore)}!root/cimv2")
That works fine. But I don't know how to bring the "(Restore)" to my
c#-program:
ManagementObjectSearcher searcher = new ManagementObjectSearcher(new
SelectQuery("SELECT * FROM Win32_NetworkLoginProfile"));
ConnectionOptions con= new ConnectionOptions();
con.Impersonation = ImpersonationLevel.Impersonate;
ManagementScope mScope = new ManagementScope("\\\\BS457\\root\\cimv2", con);
searcher.Scope = mScope;
searcher.Get(results);
Thanks
Stefan