Powershell Remote Scripting - Email Signature

Hello everyone.

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

Open in new window

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

Open in new window

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.

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mathewsitdeptAuthor Commented:

This script basically does exactly what my script does, and requires the use of Microsoft Word as I described in my original post.  Looking for another option...  

Thought I could comment on your post, accidently clicked the "Good Comment" choice...
Muhammad BurhanManager I.T.Commented:
Have you tried MS Office templates (.adm/.admx)
Or you can also set the signature with registry

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Mal OsborneAlpha GeekCommented:
I once tried to script signatures like that, but it was a real PITA.  Have you considered using a server side signatures instead?  

I have found on a  few sites a "hybrid" approach can work well. The user has configures their own signature with their name and position, the server tacks on a company logo, contact info, and any legal disclaimers.
mathewsitdeptAuthor Commented:
I'm accepting this solution because it led me to figuring out how to set the default signatures via the registry.  This wasn't a direct solution, but my script is now working properly.   For those who may come across this in a search, the default signatures for Office 2010 and later are set in the registry key located here:  HKCU:\\Software\Microsoft\Office\<VERSION>\Outlook\Profiles\<PROFILE>\9375CFF0413111d3B88A00104B2A6676\0000000[X]\New Signature
HKCU:\\Software\Microsoft\Office\<VERSION>\Outlook\Profiles\<PROFILE>\9375CFF0413111d3B88A00104B2A6676\0000000[X]\Reply-Forward Signature

The keys are binary byte arrays of UNICODE.  The value stored is the name of the Signature you want to be the default.

Thanks everyone,
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.