Wednesday, October 24, 2018

Logging out Remote Desktop users from command line

You may on occasion find yourself needing to log a remote user from your Windows server.  To do so open PowerShell as administrator and run the following commands.


This will provide you with the username and ID of all currently logged in users.

query user

      USERNAME              SESSIONNAME        ID  STATE   IDLE TIME  LOGON TIME
      user1                     rdp-tcp#6             17  Active               .  10/23/2018 8:19 PM

Once you have found the username you are looking for you can log them out by running the following command.

Invoke-RDUserLogoff -HostServer "servername" -UnifiedSessionID 17

You can run the "query user" command again to verify the user is no longer logged in.

Wednesday, September 5, 2018

Resequencing ACL Entries

Often times you need to add entries to your extended ACLs.  When you do this the numbering will change and if you do this enough times you will run out of numbers to add additional ACLs.  To resolve this problem you can simply re-sequence the numbers.

This is an example of re-sequencing starting at 10 with intervals of 10.

ip access-list resequence acl_name 10 10