I don't know if I am in the right place but here goes
I found this script on the goolge to move emails in Outlook to a PST. I get an error and I am clueless on how to get to to work. Here is the script. Any help will be great.
[Reflection.Assembly]::LoadWithPartialname("Microsoft.Office.Interop.Outlook") | out-null
$olFolders = "Microsoft.Office.Interop.Outlook.OlDefaultFolders" -as [type]
$OlClass = "Microsoft.Office.Interop.Outlook.OlObjectClass" -as [type]
$OlSaveAs = "Microsoft.Office.Interop.Outlook.OlSaveAsType" -as [type]
$OlBodyFormat = "Microsoft.Office.Interop.Outlook.OlBodyFormat" -as [type]
$Outlook = new-object -comobject outlook.application
$NameSpace = $Outlook.GetNameSpace("MAPI")
[ENUM]::GetNames($olFolders)
$NameSpace.Folders | Select Name
$Source = $NameSpace.Folders["myemail@email.com"].Folders.Item("Inbox")
$Messages = $Source.Items | Where-Object {$_.SenderName -eq "john smith"}
$PST = $NameSpace.Folders["Test.pst"].Folders.Item("test")
foreach ($msg in $Messages) {
"Moving $($msg.Subject) from $($msg.SenderName) sent on $($msg.SentOn) to the PST file."
$msg.Move($PST)
}