Hiya Kixers,

Been searching through the forums for some ideas on a script to do the following:

- Search the logged in user's outlook profile for PST's.
- Log where those PST's are - on local device or network.

Found this thread -

PST discover and move discussion

Which refers to a script which has a great deal more going on in it, than I need to deal with at this time.

I'm trying to plagurize only the bits and pieces I need, but I'm getting stuck on a few points.

For instance:

 Code:

$RootPath = 'HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles'

$DProfile = ReadValue($RootPath, 'DefaultProfile')
$WKey = $RootPath + '\' + $DProfile + '\'



I believe many of our staff won't have a "DefaultProfile" value, Outlook 2007 will create a profile value of "Outlook" if left to it's own devices, and several of our staff may have other values defined.

Here's the full code snip on searching a "profile" for attached PST's.

 Code:

$RootPath = 'HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles'

; get list of mapped drives 
$aMapped = WMIMappedDrives()

$DProfile = ReadValue($RootPath, 'DefaultProfile')
$WKey = $RootPath + '\' + $DProfile + '\'

$MServer = ReadValue($WKey + '13dbb0c8aa05101a9bb000aa002fc45a', '001e6602')
$DName = UtoA(ReadValue($WKey + '13dbb0c8aa05101a9bb000aa002fc45a', '001f3001'))

$eIndex = 0
$aIndex = -1
$EKey = EnumKey($WKey, $eIndex)
While Not @ERROR
$TVal = UtoA(ReadValue($WKey + $EKey, '001f6700'))
If $TVal
$aIndex = $aIndex + 1
ReDim Preserve $aPSTPaths[$aIndex]
ReDim Preserve $aPSTKeys[$aIndex]
$aPSTPaths[$aIndex] = $TVal
$aPSTKeys[$aIndex] = $WKey + $EKey
EndIf
$eIndex = $eIndex + 1
$EKey = EnumKey($WKey, $eIndex)
Loop

; Exit if nothing to do 
If $aIndex < 0
'No PST files are registered for user ' $DName ' - exiting!' ? ?
Exit 0
EndIf



Any guidance on adjusting this to be a bit more flexible with the user's Profile name would be appreciated.

Thanks,

TS