Night Utilities rant

Started by Andrew Carrick, July 01, 2010, 03:25:02 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Andrew Carrick

<rant> "The process cannot access the file because it is being used by another process" = a user is either on the system at 3 in the morning or has failed to log out, and that means they went on after 9.30 pm when I logged out. So why can't NU tell me who it was?</rant> That way I could persecute them.... >:(
Jelf Insurance Partnership
Hull, East Yorkshire, UK
Me and TAM used to have a thing but we've split amicably. She got the kids, I got the Camaro and the maid.

Bloody Jack Kidd

Are you in a terminal services environment, or fat client?
Sysadmin - Parallel42

Andrew Carrick

I use LogMeIn at night but remote users are on Citrix. However by the time I log in in a morning, any number of people are already on the system. Or are you thinking there is a log somewhere...?
Jelf Insurance Partnership
Hull, East Yorkshire, UK
Me and TAM used to have a thing but we've split amicably. She got the kids, I got the Camaro and the maid.

Bloody Jack Kidd

I run a couple batch files at night to tattle on who has sessions running after hours - now you could, from the file server, just run:

net file > c:\openfiles.txt

although I use something else - I'm not 100% sure of the syntax b.c. I'm not at work and cannot check the script, but...

tasklist /s [computername] /FI ImageName eq homebase.exe > c:\tattle.txt

just setup a scheduled task to run @ sometime when people should not be in and you'll soon know who to yell at.  You can just review the txt files - I actually shoot them over to a web server to make the review process a bit easier.

http://technet.microsoft.com/en-us/library/bb491010.aspx

Sysadmin - Parallel42

Andrew Carrick

Jelf Insurance Partnership
Hull, East Yorkshire, UK
Me and TAM used to have a thing but we've split amicably. She got the kids, I got the Camaro and the maid.

Jeff Zylstra

I already know who the prime offender in the office is, so I run the following script via task scheduler to close open files.  User "Kay" is my bookkeeper and night utilities station, and of course "administrator" is usually me.  Applied can leave lock files and other files open, and I have issues with open Outlook PST files because I use folder redirection.  All of these need to be closed to get a good backup, so the following script is very helpful.



@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

Andrew Carrick

Jelf Insurance Partnership
Hull, East Yorkshire, UK
Me and TAM used to have a thing but we've split amicably. She got the kids, I got the Camaro and the maid.

Jeff Zylstra

You're welcome.  Hope it helps.
"We hang the petty thieves, and appoint the great ones to public office"  -  Aesop

Jeff Zylstra

P.S.  You may want to run Rick's code first so you have evidence for their trial and execution, then you can run this code  ;D
"We hang the petty thieves, and appoint the great ones to public office"  -  Aesop

Andrew Carrick

I'm all in favour of a fair trial....
Jelf Insurance Partnership
Hull, East Yorkshire, UK
Me and TAM used to have a thing but we've split amicably. She got the kids, I got the Camaro and the maid.