New-Object : Retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-000000000046} failed due to the following error: 80080005 Server execution failed (Exception from HRESULT: 0x80
080005 (CO_E_SERVER_EXEC_FAILURE)).
At line:259 char:22
+ $outlook = New-Object <<<< -ComObject outlook.application
+ CategoryInfo : ResourceUnavailable: (:) [New-Object], COMException
+ FullyQualifiedErrorId : NoCOMClassIdentified,Microsoft.PowerShell.Commands.NewObjectCommand
You cannot call a method on a null-valued expression.
At line:260 char:35
+ $namespace = $Outlook.GetNameSpace <<<< ("mapi")
+ CategoryInfo : InvalidOperation: (GetNameSpace:String) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
You cannot call a method on a null-valued expression.
At line:261 char:37
+ $inbox = $namespace.getDefaultFolder <<<< ($olFolders::olFolderInbox)
+ CategoryInfo : InvalidOperation: (getDefaultFolder:String) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
You cannot call a method on a null-valued expression.
At line:262 char:32
+ $newFolder = $inbox.Folders.Add <<<< ("Test")
+ CategoryInfo : InvalidOperation: (Add:String) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
You cannot call a method on a null-valued expression.
At line:263 char:34
+ $MoveTarget = $inbox.Folders.item <<<< ("Test")
+ CategoryInfo : InvalidOperation: (item:String) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull