2
wmiでアクティブなセッションのみを表示する方法はありますか? 問題は、Win32_LogonSessionに非アクティブ/切断セッションが表示されることです。wmiでアクティブなセッションを取得する(Win32_LogonSessionは非アクティブ/古いセッションも返す)
ManagementScope scope = new ManagementScope(ManagementPath.DefaultPath);
SelectQuery query = new SelectQuery("Win32_LogonSession");
ManagementObjectSearcher searcher = new ManagementObjectSearcher(scope, query);
ManagementObjectCollection results = searcher.Get();
foreach (ManagementObject mo in results)
{
PrintWmiObject(mo);
}
これの出力は、この
AuthenticationPackageのようなものである - ケルベロス
キャプション -
説明 -
InstallDate -
ログオンID - 10179411
LogonType - 10
名 -
のStartTime - 20110617083244.547220 + 120
ステータス - 何について
セッションがアクティブであるかどうか – Marshal