Friday 29 January 2010

Managing Roaming Profile Size

Many of my clients have problems with their roaming profiles getting too large.
As mentioned in a previous post, this is mainly due to badly written software storing files in the roaming, rather than local, part of the user profile.  In addition to slowing down logins, there is a hardcoded limit of 90MB on roaming profiles so it is important to keep this nice and trim.
To combat this, I have written a script which can be run periodically (weekly say, overnight when the users are logged out) to clear out all the cruft that, left alone, will cause the profile to break.
Currently this script removes the following files:
  • Adobe update files
  • Real update files
  • Java cache files
  • Apple iPod & iPhone firmware updates
Hopefully this may prove useful to others, just make sure to set the PROFILE_ROOT variable to point to the location of the roaming profiles on the server.
If you want to see what it will do before, then run with the -test switch which will just output what it intends to remove, but wont actually delete anything
@echo off
REM cleanup_profiles.cmd
REM v 1.0
REM This file removes any unnecessary files from roaming profiles
REM files removed:
REM     Adobe update files
REM     Real update files
REM     java cache files
REM     ipod & iphone firmware updates
REM by Jon Reeves
REM run with -test switch to just show what would be done, but not
REM actually delete any files
REM cleanup_profiles -test
REM ***** MAKE SURE to set the PROFILE_ROOT variable *****
SET PROFILE_ROOT=E:\Shared\Profiles
REM ******************************************************
if "%1" == "-test" set TESTRUN=TRUE
SET DELETION_FILE=%TEMP%\profcleanupdeletion.txt
REM list folders to be deleted
for /F "delims=" %%u in ('dir %PROFILE_ROOT% /B /A:D') DO dir /s /b /a:d "%PROFILE_ROOT%\%%u\Application Data\Adobe" | findstr Updater >> %DELETION_FILE%
for /F "delims=" %%u in ('dir %PROFILE_ROOT% /B /A:D') DO dir /s /b /a:d "%PROFILE_ROOT%\%%u\Application Data\Real" | findstr Update >> %DELETION_FILE%
for /F "delims=" %%u in ('dir %PROFILE_ROOT% /B /A:D') DO echo "%PROFILE_ROOT%\%%u\Application Data\Sun\Java\Deployment\cache" >> %DELETION_FILE%
for /F "delims=" %%u in ('dir %PROFILE_ROOT% /B /A:D') DO dir /b /s "%PROFILE_ROOT%\%%u\Application Data\Apple Computer\iTunes\iPhone Software Updates" | findstr .ipsw >> %DELETION_FILE%
for /F "delims=" %%u in ('dir %PROFILE_ROOT% /B /A:D') DO dir /b /s "%PROFILE_ROOT%\%%u\Application Data\Apple Computer\iTunes\iPod Software Updates" | findstr .ipsw >> %DELETION_FILE%
REM do the actual deletion
REM delete directories
for /F "delims=" %%d in (%DELETION_FILE%) DO rmdir /S /Q %%d
REM delete files
for /F "delims=" %%f in (%DELETION_FILE%) DO del /F /Q %%f
echo Test run completed, no files have been deleted
REM clean up temp files

Saturday 23 January 2010

How to get SIP working through Cisco 837 router

At last!
Finally I have got a SIP softphone working through my firewall.
I spent hours and hours trying different inspection rules and nat traversal stuff and eventually gave up, but after waking up obscenely early this morning I decided to give it a quick googling.
Five minutes later it was working - seems all I had to do was disable the SIP ALG on my Cisco 837 router:
no ip nat service sip udp port 5060
And it works !
Of course now I find that sound doesnt work in Ekiga (grumble, grumble), but Twinkle works perfectly.