Wednesday, 25 February 2009

sp_MS_Marksystemobject

exec sp_MS_Marksystemobject sp_name

Allows you to mark your own stored procedure 'sp_name' as a system object.

(It cannot then be accidently deleted)


Tuesday, 24 February 2009

Saturday, 21 February 2009

Enabling 'Remote Desktops' tool in Windows 2008

Enabling "Remote Desktops" Snap-In (switch easily between RDP sessions) om Windows 2008

Start -> Run -> MMC [enter]

Add the “remote desktops” snap-in >



Once added, add the servers you want to manage >




Remember to save settings or you'll have to add them all again!

Monday, 16 February 2009

Friday, 13 February 2009

Tuesday, 3 February 2009

Tools : PSGETSID

Determines sids for machine ids >

http://technet.microsoft.com/en-us/sysinternals/bb897417.aspx

Delete SQL backup files over X days old.

Put this in a batch file and schedule it!

FORFILES /p C:\!DB_BACKUP_TEMP /s /m *.BAK /d -7 /c “CMD /C del /Q @FILE”

Careful copying the above command, the double quotes mess it up! copy into notepad, retype the double quotes, then it will be fine!

Note the -7 for 7 days.

http://thebackroomtech.com/2007/12/07/howto-automatically-remove-files-older-than-%e2%80%98x%e2%80%99-days-part-ii/

Script : Mount a TrueCrypt Volume

Assuming a standard install of Truecrypt, create a Batch (.bat) file that does this >

c:
cd\
cd \program files (x86)
cd TrueCrypt
IF EXIST
E:\path\truecryptvolume.tc truecrypt /v E:\path\truecryptvolume.tc /l x /p "secure-password" /q
IF EXIST F:\path\truecryptvolume.tc truecrypt /v F:\path\truecryptvolume.tc /l x /p "secure-password" /q

This file mounts the volume as drive letter X: (the x follows the /l parameter)
I use 2 removable drives for alternate days. They are mounted by Windows as E: and F: respectfully. This is why the script checks for both each time and uses the /q for quiet switch to surpress any error messages.

Dismounting the same volume >

c:
cd\
cd \program files (x86)
cd TrueCrypt
truecrypt /dx /q