Batch file to close open sessions, then initiate NU?

Started by Lance Bateman, December 29, 2010, 12:50:50 PM

Previous topic - Next topic

0 Members and 3 Guests are viewing this topic.

Lance Bateman

I remember seeing a thread on this before, but cannot find it.

Anyone have the batch file that would be used to close out any open sessions, close the files in TAM, then initiate the NU?

We are starting to have a problem with especially remote users not getting closed out properly - probably due to connection problems (I've run into this before).

Mark

Quote from: Lance Bateman on December 29, 2010, 12:50:50 PM
I remember seeing a thread on this before, but cannot find it.

Anyone have the batch file that would be used to close out any open sessions, close the files in TAM, then initiate the NU?

We are starting to have a problem with especially remote users not getting closed out properly - probably due to connection problems (I've run into this before).

Lance,

I think it's two different things.  There should be a batch file to close open files floating around somewhere, but I used Workspace Macro Pro to fully automate NU.
Mark Piontek, MBA
Director of Information Systems
BS in Information Systems Security

Jeff Zylstra

Here is the one that I use on my server to close out files for users who forget to logout.  It is geared to leave "administrator" and our bookkeeper "kay" logged in.  The second part of that sentence is important for obvious reasons.   ;)   I run it about 10 minutes before night utilities is scheduled to run.

I don't know if night utilities can or should be automated.  How do you advance the day for which night time utility setup you want to run?

P.S.  Credits to Nick O for providing the file some time ago.


@echo off

REM Author Neil Issa, Catalyst Technology Group, Inc., February 9, 2003

REM This file is used to close files which are open, but excludes users
REM named '____' and '______'

REM For loop runs the 'net files' command and evaluates each line of output.
REM Skip=1 skips the first line of output.
REM Tokens=1,2,3 looks at the first three columns and assigns them starting
REM with %%a, then %%b for the second column, then %%c for the third column.
REM Because %%a,b,c don't pass to the next command, they are assigned
REM to variables var_id, var_file, and var_user.
REM IF compares the username of the process to the username to be skipped.
REM The /I parameter instructs the code to ignore case of letters.
REM Call is used instead of goto to keep the for loop evaluating all output
lines.
REM func_close is used to close files which are NOT open by the specified
user.



for /f "skip=1 tokens=1,2,3" %%a in ('net files') do (
    set var_id=%%a
    set var_file=%%b
    set var_user=%%c
    IF /I NOT %%c==KAY IF /I NOT %%c==ADMINISTRATOR call :func_close
)

goto end

:func_close
net files %var_id% /close

:end
"We hang the petty thieves, and appoint the great ones to public office"  -  Aesop

Mark

Quote from: Jeff Zylstra on December 29, 2010, 03:33:33 PM
I don't know if night utilities can or should be automated.  How do you advance the day for which night time utility setup you want to run?

Same way you advance the day when you schedule it to run.  Workspace Macro Pro just records mouse clicks and key strokes and plays them back at the scheduled time.  Was worth the $63 or whatever it cost a few years ago.

I honestly forget that NU is not automated out of the box.  Accounting likes it too because they receive the reports as PDF in their email when applicable.  This is something that I may add to the wiki at some point, but I have tried to write it down more than once and never seem to complete it.

I could duplicate it 10,000 times, but writing it down is where I fail. lol
Mark Piontek, MBA
Director of Information Systems
BS in Information Systems Security

Jeff Zylstra

Please do.  If it weren't for the fact my bookkeeper wasn't in to run close day and night utilities (and my RADMIN wasn't running on my new Windows 7 machine), I wouldn't be in the office right now!  Well worth the $63!!
"We hang the petty thieves, and appoint the great ones to public office"  -  Aesop

Alice

Quote from: Jeff Zylstra on December 29, 2010, 03:33:33 PM
Here is the one that I use on my server to close out files for users who forget to logout.  It is geared to leave "administrator" and our bookkeeper "kay" logged in.  The second part of that sentence is important for obvious reasons.   ;)   I run it about 10 minutes before night utilities is scheduled to run.

I run this about 5 minutes before the backup starts so we get a good one. NU starts at a time I know the backup is definitely finished. I also run a batch file as a scheduled task to copy "startup.err" to the tam_exe folder around the same time. If someone tries to log back in to Tam after they've been kicked out, they get a message that there was an error running startup and can't log in again. They keep reporting it as a problem, but at 10pm, I don't really care since the backup starts at 9pm, and they need to get a life. (JMO)
The things we have to do...