我不能试试这个:
$pc = qwinsta /server:YourServerName | select-string "Disc" | select-string -notmatch "services" if ($pc) { $pc| % { logoff ($_.tostring() -split ' +')[2] /server:YourServerName } }