?
Solved

Login Script clean up

Posted on 2014-02-25
8
Medium Priority
?
1,809 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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 1500 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

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

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.
While working, an annoying popup showing below will come and we cannot cancel or close it form the screen. The error message will come again and again.
This Micro Tutorial will give you a basic overview of Windows DVD Burner through its features and interface. This will be demonstrated using Windows 7 operating system.
This Micro Tutorial will give you a basic overview of Windows Live Photo Gallery and show you various editing filters and touches to photos you can apply. This will be demonstrated using Windows Live Photo Gallery on Windows 7 operating system.
Suggested Courses
Course of the Month9 days, 13 hours left to enroll

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