Does anybody knows a good place where a reasonably experienced C#
programmer who knows nothing about WMI could get easy to understand info to
get started with WMI? I've not been able to find any good WMI site for
beginners using C#. Most sites are about scripting.
For example, i'm trying to write a function that allows a Windows Service
to log off a user on the local machine (either physical user or XP remote
desktop user). I've been able to come up with that:
ManagementObjectSearcher searcher = new ManagementObjectSearcher();
ManagementObjectCollection objectCollection;
object[] myParams = {4, 0};
searcher.Query.QueryString = "SELECT * FROM Win32_OperatingSystem";
objectCollection = searcher.Get();
foreach (ManagementObject managmentObject in objectCollection)
{
managmentObject.InvokeMethod("Win32Shutdown", myParams);
}
This code works great when a user is logged in "physically" but not with XP
Remote Desktop users. As i don't know how WMI really works, i can't find
the reason why this doesn't work with a Terminal Services user.
Any help or links would be really appreciated.
Thanks
"Elp" <rockf...@REMOVEME.hotmail.com> wrote in message
news:147zkwu7d5qs0.2...@40tude.net...