Hi all I have been working on this for two days now to no avail. My company is in the middle of changing its spam service from postini to Proof point. In outlook we point the junk mail folder to a site url via Junk mail properties home page tab.
If i run the following on my local machine all works perfectly. If i try to run it on a remote machine failure
Script1: saved locally on my desktop
[Reflection.Assembly]::LoadWithPartialname("Microsoft.Office.Interop.Outlook") | out-null
$olFolders = "Microsoft.Office.Interop.Outlook.OlDefaultFolders" -as [type]
$outlook = new-object -ComObject "outlook.application"
$namespace = $outlook.GetNameSpace("MAPI")
$folder = $namespace.getDefaultFolder($olFolders::olFolderJunk)
$folder.WebViewURL = "https://internal address:#####" (Can't share that)
$folder.WebViewOn = $true
I then enabled Winrm via GPO to a select set of machines for testing
Finally I wrote a new script to remotely execute on the the test machines.
Script2:
Enable-PSRemoting -Force
Invoke-Command -ComputerName (Get-Content "c:\Users\username\Desktop\testpcs.txt") -FilePath c:\Users\username\Desktop\SetJunkmailURL.ps1 -Credential domain\username
ERROR:
Retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-000000000046} failed due to the following error: 80010001.
+ CategoryInfo : ResourceUnavailable: (:) [New-Object], COMException
+ FullyQualifiedErrorId : NoCOMClassIdentified,Microsoft.PowerShell.Commands.NewObjectCommand
You cannot call a method on a null-valued expression.
+ CategoryInfo : InvalidOperation: (GetNameSpace:String) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
You cannot call a method on a null-valued expression.
+ CategoryInfo : InvalidOperation: (getDefaultFolder:String) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
Property 'WebViewURL' cannot be found on this object; make sure it exists and is settable.
+ CategoryInfo : InvalidOperation: (WebViewURL:String) [], RuntimeException
+ FullyQualifiedErrorId : PropertyNotFound
Property 'WebViewOn' cannot be found on this object; make sure it exists and is settable.
+ CategoryInfo : InvalidOperation: (WebViewOn:String) [], RuntimeException
+ FullyQualifiedErrorId : PropertyNotFound
Again this works on my local machine just not on a machine i'm trying to execute remotely.
Any help with this will greatly be appreciated.