Scripting
DSQUERY
Feb 11th
The following comand will query Active Directory for users that haven loged on in a certain amount of time.
dsquery computer -inactive 8 -limit 0
The above comands looks for computer accounts that have been inactive for 8 weeks.
If the accounts are definatly not in use then the following command can be used to clear them from Active Dierctory.
dsquery computer -inactive 8 -limit 0 | dsrm -noprompt
Disconected mail boxes in Exchange 2007
Feb 11th
When a users mailbox becomes disconnected it may not show in the EMS GUI. If the mailbox is not showing you need to use the EMS (Exchange Management Shell and enter the command Clean-MailboxDatabase <Database>, where database is the name of the database where the disconnected mailbox resides. In this particular case the command I used was Clean-MailboxDatabase “Mailbox Database”.
After this is run go back to the GUI and refresh and ALL missing disconnected mailboxes should appear. You can then re-connect in the usual manner.
Conflicker AT Task removal script
Feb 11th
Whilst dealing with the conflicker virus I noticed that it leaves behind a number of scheduled tasks that are named in the following fashion: AT1**.
I wrote a small script that removes them at start up.
TITLE CONFLICKER AT TASK REMOVAL @ECHO off SET COUNT=1 :LOOP ECHO Scanning for Jobs Begining with AT%COUNT% IF %COUNT% == 500 GOTO EOF SCHTASKS /Delete /TN At%COUNT% /F >> \\server-name\conflog\%computername%-Conflog.txt CLS SET /A COUNT=COUNT+1 GOTO LOOP :EOF
Every machine that runs the script will write to a log file on the server detailing the AT* tasks that it has found and removed.
The following link was useful: http://www.robvanderwoude.com/schtasks.php