I found this script....but I don't think it's going to do what I need it to do...can someone take a look please? Thanks!
What I want to do is Move users psts to another sharedrive and create their folder path for example
move from: \\server\username\thepst.pst
move to: \\server\username\thepst.pst
Script:
;----------------- ; Move_PST_PAB.txt ;----------------- ; This Kixtart script file will move a user's Personal ; Folders and Personal Address Book to a new location ; By doing the following: ; ; Kixtart: ; - Prompt the User ; - Copy the file to new location ; - Rename the old file so that ; Outlook can't find it. ; - Create and call an AutoIt Script ; AutoIt: ; - Open Outlook 97 ; - If an error about the PAB file appears, ; Type the new location of the address book ; - Go to Tools/Services ; - Select each Service that has changed locations ; - When Outlook prompts for the new path to the file ; type it in. ; - Exit Outlook ; ; You can obtain AutoIt for free from: ; http://www.hidden.demon.co.uk/AutoIt/index.html ;-----------------
;........................................ ; Change the following two variables to ; match the path where you want PST and ; PAB files to be moved to: ;........................................ $ExchangeFileLoc = "C:\Exchange" $ExchangeHomeDrive = "C:"
;........................................ ; Set the following variable to be the ; name of your support team. ; This is used to create custom entries ; in the Registry ;........................................ $SupportGroup = "EASG"
;........................................ ; The following variable points to the ; location of the AutoIt.exe file ; You can obtain AutoIt from http://www.hidden.demon.co.uk/AutoIt/index.html ;........................................ $AutoItPath = @LDrive + "\US\NY\MLCSIM\Autoit.exe
;........................................ ; The following key is used to track what ; files need to be migrated ;........................................ $RC=ADDKEY("HKEY_CURRENT_USER\Software\" + $SupportGroup + " Controlled Apps\NT_Migration")
;........................................ ; The User's home server is determined ; based on their Home Share ; (If no Home Share is defined, this ; script won't work) ;........................................ IF LEN(@HOMESHR) > 0 $HomeDeptServer=SUBSTR(SUBSTR(@HOMESHR,3,len(@HOMESHR)-2),1,instr(SUBSTR(@HOMESHR,3,len(@HOMESHR)-2),"\")-1) ELSE $HomeDeptServer="UNKNOWN" EXIT 0 ENDIF
;........................................ ; Delve into the registry to find Info ; About what PSTs and PABs are set up ;........................................ DO $MProfile=EnumKey($MsgKey, $ProfileCount) IF @ERROR=0 IF Len( $MProfile ) $SettingCount = 0
DO $MSetting=EnumKey($MsgKey + "\" + $MProfile, $SettingCount) IF @ERROR=0 IF Len( $MSetting ) $ValueName=ReadValue($MsgKey + "\" + $MProfile + "\" + $MSetting, "001e3001") IF @ERROR=0 ;? $ValueName ENDIF
IF $WantFileMoved = "Yes" GOSUB MakeFooter ;............................................ ; Execute the AutoIt script that was created ;............................................ SHELL $AutoItPath + " " + $ExchangeHomeDrive + "\_ExFil.txt" ENDIF
EXIT 0
;------------------ :StripPath ;------------------ ; This routine will take the UNC path and parse it out ; Into a filename and a name that the original file ; will be renamed to. (pab becomes paX while pst becomes psX) ;------------------ $FileName = substr($FileLocation,3,500) WHILE INSTR($FileName,"\") > 0 $FileName = SUBSTR($FileName,INSTR($FileName,"\")+1,500) LOOP $RenFileName = SUBSTR($FileName, 1, len($FileName) -1) + "X" RETURN
;------------------ :ProcessHere ;------------------ ; This routine will prompt the user if they want to move each ; eligible file to it's new location. ; If they say yes, an AutoIt script file is built which will ; handle the transfer ;------------------ $ServiceCount = $ServiceCount + 1
;........................................... ; If the file has already been moved to the ; New destination, don't do anything ;........................................... IF SUBSTR($FileLocation, 1, len($ExchangeFileLoc)) = $ExchangeFileLoc Return ENDIF $RC = READVALUE("HKEY_CURRENT_USER\Software\" + $SupportGroup + " Controlled Apps\NT_Migration",$FileLocation) IF @ERROR=0 ;--- This File has already been processed Return ENDIF
$MigrationComplete = "No" $RC=MESSAGEBOX("Would you like to move your Outlook " + $ExchangeFileType + " named '" + $ValueName + "' from it's current location at " + $FileLocation + " to your personal directory on the new NT Server, " + $HomeDeptServer + " at this time?" , "Windows NT Migration", 4 + 4096)
IF $RC = 7 ;--- They said no $RC = MESSAGEBOX("Do you want to move it later?", "Windows NT Migration", 4 + 4096) IF $RC = 7 ;--- They said no again $RC=WRITEVALUE("HKEY_CURRENT_USER\Software\" + $SupportGroup + " Controlled Apps\NT_Migration",$FileLocation,"DontMove","REG_SZ") RETURN ELSE ;--- They will move it later RETURN ENDIF ELSE ;--- They said yes they want to move it now IF $WantFileMoved = "No" GOSUB MakeHeader ENDIF IF $ExchangeFileType = "Personal Folder" GOSUB MakeBody ELSE $PABFileName = $FileName ENDIF
Registered: 2006-08-16
Posts: 686
Loc: Maryland, USA
Hi,
I think you might be trying something a little more complicated than you need. Could you give a little more detail about what you are trying to accomplish? If you are just trying to share where users mount from to get their pab and pst files, then I would suggest:
1. Copy the current files from the existing location to the new location and if possible, set up an rsync process of some type to keep the new location updated. 2. If they had been mounting from:
\\server1\exchange\users\username
Then make the new location:
\\new_server\some_other_share\users\username
Just in the startup script delete the current share mounting and create the new one. The change will be transparent to the users and their outlook programs. As each person logs in and gets his share re-mapped, you can have a message of that fact sent to you so you will know who has and who has not re-mapped to the new server.
If I missed what you are trying to accomplish, again, please send some more details.
Registered: 2006-08-16
Posts: 686
Loc: Maryland, USA
Again, I think you are making it more complicated than it needs to be.
How many users are you talking about? If it is a small number, I would just tell everyone they have to be logged off their systems by x o'clock on Friday night. Then, from your server, copy all of the user files from the one server to the other. Modify your startup script to delete the current f drive and map the new f drive.
If it is a large number, you still do the same thing except I would add some sort of rsync process from the old pst shares to the new ones in case someone doesn't listen and stays logged in.
In either case, outlook won't have to change because it will find the pst files in the exact same location.
Does that make sense? Do the work from your server, not from a client script.
gotcha....I see what you mean...it is approximately 325 or so.
Oh, but one thing. The pst folder they have is on their personal share drive...so they have other docs etc on it. I need to specifically pull the path \\servername\username\outlookpst
It would be too time consuming to copy each folder manually so I wanted a script to either copy or move that specific folder from each users personal drive and create \\newservername\username\outlookpst\
We dont have anything in our login script pertanining to outlook. When a user creates a pst they have been manually creating it and pointing it right to the folder on their F:\ called OutlookPST...
Registered: 2006-08-16
Posts: 686
Loc: Maryland, USA
Is there a reason you are splitting the pst files out of the user's personal share? That makes it more complicated. In any case, you should be able to write a script to run on your server to find all the pst and pab files under a given directory and copy them to their new location. Then you can add the map to the second drive in your startup script.
As far as changing the mappings in outlook - take a look in the udfs and see if you can find anything to help. Unfortunately, I can't get in to the registry on my system so I can't look for keys. Maybe someone else can pipe in with a COM solution.
We want to have all PST's located in one central location. I'm new to kixstart and scripts in general so this is going to be a HUGE challenge...but I have 1 week from today to get it done. I appreciate any and all help.
If I can figure out how to move them from one location to another as the first step that would be a start.
Well just an FYI that if you attempt to do this from a Logon script you're looking for some real problems unless you have a very robust network and server.
Moving a PST during a logon script is going to put a LOT of data in motion at or around the same time. Also some people may have Outlook setup in their Startup folder which would then lock the PST from being copied/moved.
Also if you change a drive mapping to the location then the Registry for that profile also would need updating.
Registered: 2003-01-28
Posts: 4396
Loc: New Jersey
Oddly enough, we just started a mail archive project this week. In the coming week, I'll be implementing a set of scripts that does what you want - sort of.
We are deploying a GPO that prevents users from accessing PST files. Once that's in place, code will be placed in the login script to run on the user's PC. This script will terminate outlook, identify the location of all PST files, rename each PST file so the user and outlook can't find it, then identify the path of the PST (in its newly named form) to a central process. That process will then move the file to a central location. The login process happens in 3-4 seconds, while the background file copy can take quite a while, depending on size. The advantage of this is that many of our users have their PSTs in a central file server where their home profile structure is mapped to. The move will happen server to server.
The backend process will return the file to its original name and log it into the archiving system for processing.
I should be able to post some code in a week or so.
Glenn
_________________________ Actually I am a Rocket Scientist!
Registered: 2003-01-28
Posts: 4396
Loc: New Jersey
Here's Vresion 1.0 of the part that runs in the login script. It runs very quickly, and identifies the PSTs used by the default profile. It terminates outlook if it is running, disassociates the PSTs from outlook, renames the PSTs, and writes a log to a central network server. Individual logs are written by each workstation.
Each time it runs, it creates a unique log file, which is then processed by a back-end script. That reads all the files, identifies the locations, and moves them within the local server to a processing folder. This eliminates network copying. I'll post the backend script as I complete it.
One thing missing from this release is any logic to prevent it from running multiple times. This would be easy to implement by writing a registry value and exiting immediatly if it was present. Add this after testing/modification is complete.
Glenn
_________________________ Actually I am a Rocket Scientist!
Registered: 2003-01-28
Posts: 4396
Loc: New Jersey
Reading your posts again, it seems like this would be a good starting point for you - here's the mods I'd consider:
It might be better to move the files interactively, rather than on the back end.
Modify the Move line so the destination path is your common share instead of the original folder. My method is a simple rename, but you can actually move the file by specifying a new target path. The PST files will all have the format "USERID_originalname.PST", which should work well if they are all in a common folder.
Don't run the Disassociate command - instead, update the path in the registry to reflect the new path and file name. Actually, you might want to update the registry with the new path, export the registry key, then delete the key. This will prevent outlook from opening the file while it is moved. Once the move completes, you can import the reg key and Outlook will find the PST in its new location the next time it starts.
You can eliminate the log, or place the log on the local system to aid in troubleshooting, rather than using a central logging folder.
You can update the script so if the PST file is already in the new location, simply exit.
Keep in mind that users may have very large PST files, and it could take several minutes to several hours to copy, depending on size and network speed. (copying a 3Gig PST over a 256K Frame Relay link can take a LONG time!) The user will not be able to access the PST during this time.
Hope that gets you a start in the right direction.
Glenn
_________________________ Actually I am a Rocket Scientist!
You are the man! It's working great....the only thing I don't need it to do is "rename the psts" and I need it to move them to a share....once I figure that out it will be perfect! Excellent!!
Registered: 2003-01-28
Posts: 4396
Loc: New Jersey
Read my second post more carefully - you still need the MOVE line, but need to change the second part - different destination path instead of a new filename. The MOVE command will RENAME the file if the source and destination PATH is the same, but will MOVE the file if the paths are different.
Seems like all you need to do is a few minor mods:
Code:
Dim $NewPSTPath ; instead of $NewPSTName
; define the NewPSTPath instead of NewPSTName
$NewPSTPath = '\\server\share\@USERID'
; Make sure the destination folder exists
MD $NewPSTPath
; adjust the Move command to use the new target path with the original name
Move $PSTPath + $PSTName $NewPSTPath + '\' + $PSTName
Glenn
_________________________ Actually I am a Rocket Scientist!
Well, i actually think I was making this harder than i needed to...like stated above...I don't think there is a way to make outlook capture the new path of the pasts after they are moved through the registry is there?
I can just move the users pst's for now until i figure out how to make outlook map to the new location of the psts since they are not being renamed...I'm just changing paths.
I'm not at your advanced level so I can only do but so much haha.
Registered: 2003-01-28
Posts: 4396
Loc: New Jersey
Ah, yes... you need to create a AtoU() UDF to update the path in Outlook, for each registry path where the '001f6700' value is found. This is the PST path, in what appears to be Unicode format.
Glenn
_________________________ Actually I am a Rocket Scientist!