Registrations to Open-AudIT forums are now closed. To ask any new questions please visit Opmantek Community Questions.

Open-AudIT

What's on your network?
It is currently Tue Mar 19, 2024 4:52 pm

All times are UTC + 10 hours




Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
PostPosted: Tue Nov 13, 2007 3:05 am 
Offline
Moderator
User avatar

Joined: Tue Jan 25, 2005 3:09 am
Posts: 2140
Location: Scotland
Just a quick trick.... If you use XP to audit your domain you can also use the [color=#400080]at[/color] command to schedule an audit every day, hour or whatever.

The advantage of using at is that it can interact with the desktop although arguably, this may be a disadvantage if you are trying to use the machine to do something else... in which case I suppose, don't use the /interactive switch, and send the output to >null

You can use the Contol Panel > Scheduled Tasks to do the same thing, however this will not interact with the desktop particularly well.

To audit the domain every day at 18:00 try something like
[code]
at 18:00 /interactive /every:M,T,W,Th,F,S,Su "C:\Program Files\xampp\htdocs\scripts\audit_mydomain.bat"
[/code]

Where audit_mydomain.bat contains something like...

[code]
@echo off
rem audit local domain pcs
cscript audit.vbs
cscript nmap.vbs

:end
[/code]

This batch file will run the audit script followed by the nmap script, and you can see the results on the PC screen when you return the next morning.

To delete an at task, identify the at tasks by typing ... at .. obviously..

[code]
W:\>at
Status ID Day Time Command Line
-------------------------------------------------------------------------------
1 Each M T W Th F S Su 18:00 PM "C:\Program Files\xampp\htdocs\scripts\audit_mydomain.bat"
W:\>
[/code]

In this case delete task 1 with

[code]
at 1 /delete
[/code]

If you would like to script a scheduled task to do the same thing, things are slightly more complicated, since scheduled tasks require a user and password to operate.

Windows XP has a CLI interface to scheduled tasks called schtasks (note schtasks not schtask)

For the same task details try...

[code]
SCHTASKS /Create /S system_name /U DOMAIN\user /P password /RU runasuser /RP runaspassword /SC DAILY /ST 18:00:00 /TN DailyAudit /TR "c:\Program Files\xampp\htdocs\scripts\audit_mydomain.bat"
[/code]

(Nice and simple as you can see... :twisted: )

For full details of SCHTASKS /Create syntax try

[code]
W:\>schtasks /create /?

SCHTASKS /Create [/S system [/U username [/P password]]]
[/RU username [/RP password]] /SC schedule [/MO modifier] [/D day]
[/I idletime] /TN taskname /TR taskrun [/ST starttime] [/M months]
[/SD startdate] [/ED enddate] ... this goes on for several pages.....(AJH)
[/code]


NOTE: the AT and SCHTASKS commands keep their schedules entirely separately, so adding a task in at will not make it visable in Contol Panel > Scheduled tasks,

_________________
Andrew

[size=85]OA Server: Windows XP/ XAMPP, Mandriva/Apache, Ubuntu
Auditing: 300+ Wstns, 20+ Srvrs, Thin clients, Linux boxes, Routers, etc
OS's: Windows XP , W2K Srvr, W2K3 Srvr, W2K8, Vista, Windows 7, Linuxes (and a Mac at home)
LDAP: Active Directory[/size]


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC + 10 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group