Archive | Windows

Detach PSTs

We are looking to get rid of .pst files in our environment and we wanted to remove pst files from peoples machines. This link shows how to prevent adding new psts and how to turn off auto archiving via GPO, but what about existing .psts in peoples Outlook profiles?

I put together this vbscript:

Set objFSO = CreateObject( "Scripting.FileSystemObject" )
Set objOutlook = CreateObject( "Outlook.Application" )
Set objNamespace =objOutlook.GetNameSpace( "MAPI" )

For i = objOutlook.Session.Folders.Count To 1 Step -1
    strName = objOutlook.Session.Folders.Item(i).Name
    if instr(strName,"Mailbox -") > 0 or strName = "Public Folders" or strName = "SharePoint Lists" or strName = "Microsoft Dynamics CRM" then
       'wscript.echo "not removing:" & objOutlook.Session.Folders.Item(i).Name
    Else
       'wscript.echo "removing:" & objOutlook.Session.Folders.Item(i).Name
       objOutlook.Session.RemoveStore(objOutlook.Session.Folders.Item(i))
    End If
next

Powered by WordPress. Designed by WooThemes