Solved

Login Script clean up

Posted on 2014-02-25
8
1,685 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
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.

 

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

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.

Question has a verified solution.

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

When you start your Windows 10 PC and got an "Operating system not found" error or just saw  "Auto repair for startup" or a blinking cursor with black screen. A loop for Auto repair will start but fix nothing.  You will be panic as there are no back…
A quick guide on how to use Group Policy to create a custom power plan and set it active on Windows 7.
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…

832 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