Solved

Login Script clean up

Posted on 2014-02-25
8
1,627 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
 

Author Comment

by:BMCISAdmin
Comment Utility
Is there anyway to incorporate the OAB files into the VBS?
0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
LVL 13

Expert Comment

by:Santosh Gupta
Comment Utility
0
 

Author Comment

by:BMCISAdmin
Comment Utility
looking for a machine to test on.
0
 

Author Comment

by:BMCISAdmin
Comment Utility
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
Comment Utility
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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

One of the features I've come to appreciate about Windows 7 and Windows Server 2008 R2 is the ability to pin applications to the task bar. As useful a feature as I've found this, it does have some quirks.  For example, have you ever tried pinning an…
If you get continual lockouts after changing your Active Directory password, there are several possible reasons.  Two of the most common are using other devices to access your email and stored passwords in the credential manager of windows.
This Micro Tutorial will give you basic overview of the control panel section on Windows 7. It will depth in Network and Internet, Hardware and Sound, etc. This will be demonstrated using Windows 7 operating system.
The viewer will learn how to successfully download and install the SARDU utility on Windows 7, without downloading adware.

762 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now