Friday, November 19, 2010

VB Scripts to Prevent users from saving anything on desktop


I have coded a pair of scripts to  ensure that no data is saved on desktop by the user. The scripts have been tested on a Windows 2008 R2 server with XP (23bit) and Windows 7(32 bit ) clients. First script executes when the user logs off and the second when the user logs in
Logoff script name : desktop_backup.vbs
login Script: deferred_backup.vbs
The log off script moves all the contents of desktop to server. The second script (login) is primarily a backup script , aim to move contents to desktop just in case there is an network interruption. The log off script works in the following manner             Move contents of desktop to a temp folder in the users home directory.
the temp folder is named  in following format (DD-MM-YYYY@hhmm-computer_netbios_name)
Just in case desktop folder gets deleted (due to move action), recreate the folder
Check whether the temp folder is empty (in case the user desktop is empty) , if yes delete the temp folder,
if no proceed with moving action
create a folder with same name  as temp folder on server.
If no joy (indicating permissions or network error), create a deferred folder for move while logging in and move contents there.


The login script works in following manner
            Check if deferred folder exists (indicating that there was a network error during logoff), try move to server again
            if no joy then proceed and wait till share is restored.

Both the scripts are heavily commented for customisation
Hope they are useful.

No comments:

Post a Comment