Messages - AzureToad [ switch to compact view ]

Pages: prev1 ... 8 9 10 11 12 [13] 14 15 16 17 18 19next
61
Wow, I like how compact your example is!  :up:
I managed to modify my script, using an array of users and a FOR loop, somewhat similar to yours.

Output from the QUERY USER /SERVER: looks the same as query on localhost.  Here's a sample (names changed, of course):
Code: Text [Select]
  1. USERNAME              SESSIONNAME        ID  STATE   IDLE TIME  LOGON TIME
  2.  ablebz                                    2  Disc         4:25  5/5/2015 5:33 AM
  3.  wertala                                   4  Disc         2:57  5/5/2015 10:21 AM
  4.  trowe801              rdp-tcp#40          7  Active       5:18  5/5/2015 10:49 AM
  5.  aspensma                                  8  Disc         4:17  5/5/2015 3:18 PM

After looking at your code a bit more, i think it would have to be modified a bit. I think you'd need to create a file of the users that should NOT be logged off, then have a FOR loop for each server, and have a FOR loop extracting each user currently logged on that server. Then you could use the FIND command to see if the current login ID is in the file to be ignored, and if it's not, then you'd issue the LOGOFF command.  Unless I totally missed your example?

Bottom line, I finally did get my script to work.
Thanks for your reply!

62
General Software Discussion / Help with Windows batch script
« on: May 05, 2015, 11:11 AM »
Ok, 1st off, I'm guessing this probably isn't the best place for this post. If not, someone can move it to the best area - as long as it's not the trash bin!

I am having problems with a Windows batch script. Maybe someone out there can point out my error.

What I'm trying to do is to retrieve a list of remote desktop sessions on a server, then log each one off unless the login name matches a list of names to be ignored.
The list of sessions and logging off is not a problem. It's when I need to check against the list of names that I have a problem.

Here's my code:

Code: Text [Select]
  1. SET serverlist=APPLE BANANA CHERRY
  2. FOR %%s in (%serverlist%) DO (
  3.         FOR /f "tokens=1,2,3" %%a IN ('QUERY USER /server:%%s^"') DO (
  4.                 ::      Don't log off this list of users:
  5.                 ::      administrator, Zebra, Yankee
  6.                 IF /I [%%a] EQU [administrator] (
  7.                         ECHO Ignored user %%a
  8.                 ) ELSE (
  9.                         IF /I [%%a] EQU [Zebra] (
  10.                                 ECHO Ignored user %%a
  11.                         ) ELSE (
  12.                                 IF /I [%%a] EQU [Yankee] (
  13.                                         ECHO Ignored user %%a
  14.                                 ) ELSE (
  15.                                         IF %%c LSS 65536 (
  16.                                                 ECHO Logging off ACTIVE user %%a on session %%c
  17.                                                 LOGOFF /server:%%s %%c
  18.                                         ) ELSE (
  19.                                                 IF %%b LSS 65536 (
  20.                                                         ECHO Logging off DISCONNECTED user %%a on session %%b
  21.                                                         LOGOFF /server:%%s %%b
  22.                                                 )
  23.                                         )
  24.                                 )
  25.                         )
  26.                 )
  27.         )
  28. )

When I DON'T check for individual login names, all users are logged off. That part works great - has been working for years.
Checking for the individuals doesn't work - all users are logged off anyway with the message indicating whether they were active or disconnected.

PLUS, with username checking, the script stops after the 2nd server loop. Server APPLE and BANANA are checked and all users are logged off, but the loop stops without checking server CHERRY.
  (Turns out the script only had APPLE and BANANA defined - no CHERRY on top!)

I figured I must have an unbalanced parenthesis, but I've gone over this until my head hurts and can't find it.  So I turn to this group for help.

63
Interesting update.
If I use a non-Aero Windows theme, the titlebar clock shows on each display as one would expect.
So... I guess we can ignore this issue and chalk it up to some Aero oddity.

64
TicTocTitle  :Thmbsup: from skrommel displays the time, date, and toggle key states (configurable) in the active window's titlebar.
Original forum thread

Currently when a window on my 2nd or 3rd display has the focus, the time is displayed on the desktop of the 1st display.

Is there some setting to get TicTocTitle to work correctly for multiple displays? 
Help > About shows I'm running v1.5.


65
Living Room / Re: wierd mouse click problem
« on: February 05, 2015, 09:25 AM »
Been using a Logitech M705 for nearly 3 years. 
My experiences have been similar, but not exactly the same.
I've always thought that a fresh set of batteries took care of my problems.

Pages: prev1 ... 8 9 10 11 12 [13] 14 15 16 17 18 19next
Go to full version