I'm looking for some input on some other possible solutions to setting a default signature in Outlook with PowerShell. I've been able to do this with no issues in a script that executes on user login. I tried to expand the functionality a little in order to allow our help-desk staff to push an email signature to a user from a web console. Everything in the script is working except for the portion of making the signature "available" and setting as the default. I can successfully FORCE the signature, which prevents the end user from being able to switch between multiple signatures. I have several users who need to switch between multiple signatures, so this is not an option for everyone.
The force method just utilizes a few registry keys to force and lock the signature.
In order to make the signature "available" and set as default, its appears that the only method I can find reference to is using Word to do this.
Here is the code snippet for the word portion:
$MSWord = New-Object -comobject word.application
$EmailOptions = $MSWord.EmailOptions
$EmailSignature = $EmailOptions.EmailSignature
$EmailSignature.NewMessageSignature = $SignatureName
$emailSignature.ReplyMessageSignature = $SignatureName
As stated, this will work fine in the login script, or even if our help-desk employee remotes in and executes the script from the end-user's computer. I was hoping to automate the entire process.
If you try to execute the above code remotely, ie. though the use of Invoke-Command or Enter-PSSession I receive an error like this:
Exception setting "NewMessageSignature": "No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE))"
+ CategoryInfo : InvalidOperation: (:) , RuntimeException
+ FullyQualifiedErrorId : PropertyAssignmentException
+ PSComputerName : computer.domain.com
I believe this may be related to not having a GUI session. I've seen others refer to this error when trying to automate the conversion of a .DOC file to a .PDF remotely. Neither what I am doing or the document conversion require or produce a graphical interface, but both seem to fail remotely.
I am having no issues on running powershell scripts or commands remotely. I have CredSSP setup and working, this all seems to come down to determining if there is a way other than using Word to set the default signature in Outlook.