[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1926
  • Last Modified:

Login Script clean up

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
BMCISAdmin
Asked:
BMCISAdmin
  • 4
  • 4
1 Solution
 
Santosh GuptaCommented:
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
 
BMCISAdminAuthor Commented:
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
 
Santosh GuptaCommented:
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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
BMCISAdminAuthor Commented:
Is there anyway to incorporate the OAB files into the VBS?
0
 
Santosh GuptaCommented:
0
 
BMCISAdminAuthor Commented:
looking for a machine to test on.
0
 
BMCISAdminAuthor Commented:
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
 
Santosh GuptaCommented:
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now