Take the 2-minute tour ×

I'm pulling my hair out trying to write a script, powershell or VBS, that will recursively search for user PST files and move them to dedicated DFS shares for each user. (As part of log off users have been running the "move open/connected pst files" script sourced from this site, so any pst files left behind will not be in use/open by users)

Source would be: E:\users[user logon name]\

Destination would be: \share\pst[user logon name]\Not_Connected[archive name]-[appended with date created].pst

Many users have multiple archive.pst files in various different directories under their E:\users[user logon name]\ directory so need to ensure that as files are moved over there's no chance of them overwriting each other.

I've started with

$include = @("*.pst") $filestocopy = Get-ChildItem "E:\users*" -recurse -force -include $include

foreach ($file in $filestocopy) { $destfilpath = ([IO.DirectoryInfo](Split-Path $.FullName -Parent)).Name Write-Host "Renaming $ to $($destfilename).pst..."

But I'm stuck as to where to go from here!

Any help would be really really appreciated!

Thanks folks!

share|improve this question
add comment


Your Answer



Browse other questions tagged or ask your own question.