none
Logoff username remotely RRS feed

  • Question

  • Hi, 

    I am looking for command/set of commands (DOS OR Powershell) using which I can remotely logoff a User (using it's LoginId as an input in the command. Without using SessionId of the user)



    Thursday, October 10, 2019 4:55 PM

All replies

  • HI
    HI
    1 can you enter winver in command prompt on both client computer and remote pc then look the os version and os version number ?[for example windows 10  enterprise 1809 (os build 17763.316)]
    2  "LoginId "
    unfortunately, there is no loginid information in RDS.can we use session id or session name to logoff session ?
    Terminal Server Commands: LOGOFF
    https://support.microsoft.com/en-sg/help/186477/terminal-server-commands-logoff

    Best Regards
    Andy YOU
    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.


    Friday, October 11, 2019 7:30 AM
    Moderator
  • Hi Andy,

    Thanks for the response, I am looking for a basic command/set of commands wherein front line technician  will only provide "servername" and "loginid" of user which should logoff provided loginid logoff from that server since provider of server name and user name inputs doesnt have access to set of servers wherein logoff action must be executed using a service account.

    If you say, using loginId logoff is not possible, Can we query sessionId of provided loginId to perform logoff actions by retrieving sessionId in some powershell variable.

    Thanks in Advance

    Friday, October 11, 2019 7:41 AM
  • Hi,

    You can query session ID and log off users with this by knowing both session ID and computer name.

    You can use QUser /server:ComputerName to get a list of login sessions on the remote computer.

    Example:

    To remotely log off any users on the list, use the command line Logoff with the remote session ID you collected from QUser command.

    Logoff sessionID /server:ComputerName

    Example:

    Best regards,
    Leon


    Blog: https://thesystemcenterblog.com LinkedIn:

    Friday, October 11, 2019 7:55 AM
  • Hi Leon,

    As i mentioned while posting it that i want to logoff a user by inputting Loginid in command rather than user's Sessionid.

    If there is no way to logoff a user by providing his/her Loginid then can Sessionid of desired username be captured in powershell variable and used in the logoff command?

    Friday, October 11, 2019 2:41 PM
  • I know you wanted to achieve this with loginID, but I’m afraid that it’s not possible, hence why I’m proposing to use the sessionID instead.

    For PowerShell scripting questions I suggest you reach out to the experts in the PowerShell forum:

    https://social.technet.microsoft.com/Forums/en-us/home?forum=winserverpowershell


    Blog: https://thesystemcenterblog.com LinkedIn:

    Friday, October 11, 2019 2:49 PM
  • This might be what you're looking for:

    https://social.technet.microsoft.com/Forums/windows/en-US/16f3aaf9-7333-45d8-a311-3c9fde494e31/logoff-a-specific-user-powershell-script?forum=ITCG

    • Proposed as answer by GouravIN Friday, October 11, 2019 3:25 PM
    Friday, October 11, 2019 3:20 PM
  • HI MS-WinTechie
    3 can you detail explain where login id from ,is it from your internal HR system software ?
    Is the login id a string of Numbers ?
    4 how login id a
    ssociate with the active directory domain account ?


    Best Regards
    Andy YOU
    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    Sunday, October 13, 2019 11:21 AM
    Moderator
  • HI
    Is there any progress on your question?

    Best Regards
    Andy YOU
    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    Wednesday, October 16, 2019 9:50 AM
    Moderator
  • HI
    Is there anything to help you ?

    Best Regards
    Andy YOU
    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    Sunday, October 20, 2019 10:14 PM
    Moderator