Solved

Login Script clean up

Posted on 2014-02-25
8
1,712 Views
Last Modified: 2014-03-20
Recently discovered I had an issue with my Global Address Book on Exchange not being able to update Offline Address Books across the company.  this is prompted me to dig out an old project that I never really got working.  I want to build a VB Script that when a user logs in that it cleans up their profile of temp files and deletes the OAB files.  The trick I have run into is that I have a mixed enviroment of XP and 7 and I am not that strong in VB Scripting.  I plan on incorporating the script into my login script which I have attached.  Any help is much appreciated.
0
Comment
Question by:BMCISAdmin
  • 4
  • 4
8 Comments
 
LVL 13

Expert Comment

by:Santosh Gupta
ID: 39886249
Hi

Find the attached VB script. it will delete the user profile temp file and OAB file depending on OS type.

Please check it first on test machine before applying to GPO.
deleteTempFiles.vbs
0
 

Author Comment

by:BMCISAdmin
ID: 39892894
I tested the script on an XP machine and it did not delete the oab files.  

The files are at,
for Windows XP:
C:\Documents and Settings\%Username%\Local Settings\Application Data\Microsoft\Outlook

for Windows 7:
C:\Users\%Username%\AppData\Local\Microsoft\Outlook

I am not totally sure what this script did.
0
 
LVL 13

Expert Comment

by:Santosh Gupta
ID: 39893017
hi,

use attached two script.

1. VBS- will delete temp files,
2. BAT - will delete OAB files. (remove .txt and keep only as .bat)

Please check it first on test machine before applying to GPO.
deleteTempFiles.vbs
DelOAB.bat.txt
0
Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

 

Author Comment

by:BMCISAdmin
ID: 39895367
Is there anyway to incorporate the OAB files into the VBS?
0
 
LVL 13

Expert Comment

by:Santosh Gupta
ID: 39895558
0
 

Author Comment

by:BMCISAdmin
ID: 39907348
looking for a machine to test on.
0
 

Author Comment

by:BMCISAdmin
ID: 39917546
I tested the deleteTempFileswithOAB.vbs and get error line 125.  I did further testing with the original script and found a bit of an issue but luckily i had the user's Outlook files backed up.  It deleted the archive.pst file in the outlook directory in the user's profile.  The other unfortunate side effect that I didn't account for is user's with large mailboxes.  His mailbox took close to 20 minutes to sync in which time Outlook was unbearably slow.  

With the original cleanup script I also found that it is not cleaning out the Temporary Internet files in the profile.  I went to the directory and there was still quite a bit of stuff in it.

I was wandering in the interest of simplifying if we could do separate scripts for each goal we are trying to achieve.  Separate scripts for Temp files, Temp Internet Files, OAB files.  I look at the script and to be honest I partially understand what it is doing but it is still a bit over my head.  Maybe by splitting them up I will understand it better.  i am trying to learn VBS so that I can do this on my own at some point.
0
 
LVL 13

Accepted Solution

by:
Santosh Gupta earned 500 total points
ID: 39917644
Hi,

1. deleteTempFilesOriginal.vbs - this script is used to delete, All files from
   a) C:\Users\%userprofile%\AppData\Local\Temp
   b) C:\Windows\Temp

Directories. When you will apply it with group policy logon GPO, it will run with for all use who will loggedin.

2. DelOAB.bat - (pls rename the attached file as we cannot attach the batch file on experts exchange).This script will delete *.oab file from below two directories.
a)  %userprofile%\AppData\Local\Microsoft\outlook\*.oab
b) %userprofile%\Local Settings\Application Data\Microsoft\Outlook\*.oab

Again this will work for current user.

Apply both Scripts in Test machine local group policy--> Logon Script first.
deleteTempFilesOriginal.vbs
DelOAB.bat.txt
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
On some Windows 7 (SP1) computers, Windows Update becomes super slow even the computer is reasonably fast.  There's one solution that seemed to have worked well for me (after trying a few other suggested solutions).
This Micro Tutorial will go in depth within Systems and Security in Windows 7 and will go into detail regarding Action Center, Windows Firewall, System, etc. This will be demonstrated using Windows 7 operating system.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

789 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question