Outlook signature based on user information from Active Directory

Create Outlook signature based on user information from Active Directory.

Add to favorites
E-mail Twitter del.icio.us Digg Facebook
Sign in to ask a question

  • Folder Signatures
    3 Posts | Last post May 29, 2014
    • Hello Jan,
      I have two problems,
      If the Signatures folder does not exist, in %appdata\microsoft, it will create the folder? in my case is not creating.
      tested it on two computers but the script did not add signature in Outlook 2010, and no error has occurred in the script.
      What can I do?
    • Hi,
      No, but this is a great enhancement to add.
      You can use Test-Path in an if statement to check if the $LocalSignaturePath exist, and if it does not, use New-Item to create it.
    • A little late but here is the code I used to accomplish what you are asking:
      If (Test-Path $LocalSignaturePath) {}
      {New-Item -ItemType directory -Path $LocalSignaturePath}
  • Problem with Win 8.x/Server 2012
    1 Posts | Last post May 29, 2014
    • For some reason calling up word as a com object in Windows 8 / Server 2012 causes outlook to launch if not configured and if configured Outlook will prompt for credentials. 
      This simple code is enough to trigger the issue:
      $MSWord = New-Object -com word.application 
      $fullPath = "C:\Temp2\test.docx"
      I opened a premier case with MS support and they told me using com objects to open office apps in the background is not supported by MS.  Which is a shame because this script has been working great for my windows 7 enterprise desktops and office 2013.  At this point I will have to abandon this great script and find an alternative to creating a signature in outlook...
  • Outlook \ Word 2013
    3 Posts | Last post May 20, 2014
    • I have been using this script without any issues with Outlook 2003 and 2007, however now we have some computers using Office 2013 and the script is returning errors. Same error for each HTML, RTF and Text
      Unable to find type [Microsoft.Office.Interop.Word.WdSaveFormat]: make sure that the assembly containing this type is loaded.
      At C:\Users\temp\Desktop\Set-OutlookSignature.ps1:247 char:73
      + $saveFormat = [Enum]::Parse([Microsoft.Office.Interop.Word.WdSaveFormat] <<<< , “wdFormatHTML”);
          + CategoryInfo          : InvalidOperation: (Microsoft.Offic...rd.WdSaveFormat:String) [], RuntimeException
          + FullyQualifiedErrorId : TypeNotFound
      [ref] cannot be applied to a variable that does not exist.
      At C:\Users\temp\Desktop\Set-OutlookSignature.ps1:249 char:59
      + $MSWord.ActiveDocument.saveas([ref]$path, [ref]$saveFormat <<<< )
          + CategoryInfo          : InvalidOperation: (saveFormat:Token) [], RuntimeException
          + FullyQualifiedErrorId : NonExistingVariableReference
      Exception setting "Color": "Exception from HRESULT: 0x800A1018"
      At C:\Users\temp\Desktop\Set-OutlookSignature.ps1:172 char:18
      +  $selection.Font. <<<< color ="wdColorGreen"
          + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
          + FullyQualifiedErrorId : PropertyAssignmentException
    • Having the same problem out of the blue after it was already working and tested. Found the issue with Outlook 2013 on Windows 7 64-bit, along with on Outlook 2007 on Windows XP 32-bit. Issue is hit-or-miss since it works on some but not others.
    • How we got it to work, and sure its a mess, is the following changes to the code:
      #Fixes Enumeration Problems
      $wdTypes = Add-Type -AssemblyName 'Microsoft.Office.Interop.Word' -Passthru
      $wdSaveFormat = $wdTypes | Where {$_.Name -eq "wdSaveFormat"}
      #Save HTML
      $path = $LocalSignaturePath+'\'+$SignatureName+".htm"
      $MSWord.ActiveDocument.saveas([ref]$path, [ref]$wdSaveFormat::wdFormatHTML);
      $MSWord.ActiveDocument.saveas($path, $wdSaveFormat::wdFormatHTML);
      #Save RTF 
      $path = $LocalSignaturePath+'\'+$SignatureName+".rtf"
      $MSWord.ActiveDocument.SaveAs([ref]$path, [ref]$wdSaveFormat::wdFormatRTF);
      $MSWord.ActiveDocument.SaveAs($path, $wdSaveFormat::wdFormatRTF);
      #Save TXT    
      $path = $LocalSignaturePath+'\'+$SignatureName+".txt"
      $MSWord.ActiveDocument.SaveAs([ref]$path, [ref]$wdSaveFormat::wdFormatText);
      $MSWord.ActiveDocument.SaveAs($path, $wdSaveFormat::wdFormatRTF);
      Oddly some of our test systems did not like the [ref] and other wanted it, so we put it in twice until we can figure out why. However it works now on Office 2013, Office 2010, Office 2007 and across Windows XP and Windows 7 (x86 and x64)
  • Different signatures for New mail and replies forwards
    1 Posts | Last post January 31, 2014
    • The code at http://www.edugeek.net/blogs/thescarfedone/1108-remote-desktop-thin-client-part-2-prev.html works. Can anyone suggest how to make two signatures, one for new mail and one ofr replies/forwards.
  • Hi there
    1 Posts | Last post September 17, 2013
    • Im recieving that error can you help me about it? Many Thanks 
      Missing closing ')' after expression in 'if' statement.
      At D:\temp\Set-OutlookSignature.ps1:74 char:1
      +  <<<< {}
          + CategoryInfo          : ParserError: (CloseParenToken:TokenId) [], ParseException
          + FullyQualifiedErrorId : MissingEndParenthesisAfterStatement
  • TXT Signature is not fully working
    1 Posts | Last post February 05, 2013
    • Hi everyone,
      I have a small issue. All signatures are fully working exept the TXT signature because it is saved as Word in the script so when signatures are created we see correctly the DOCX, RTF, HTM signatures but the TXT if it is opened in Notepad it appear unreadable caracters and in Word it is what we want. The problem is in my outlook 2007 it is opening the unreadable caracters.
      Someone can help me?
  • [REF] problem
    3 Posts | Last post January 21, 2013
    • Hello everyone,
      On some PC where I deployed the outlook signature I have this error. All lines calling this part of word (SaveAs) with [ref] I have this error. Could you help me?
      Argument: '1' should not be a System.Management.Automation.PSReference. Do not
      use [ref].
      At \\BLABLABLA\set-OutlookSignature.ps1:459 char:30
      + $MSWord.ActiveDocument.SaveAs <<<< ([ref] $path, [ref]$SaveFormat::wdFormatTe
          + CategoryInfo          : NotSpecified: (:) [], MethodException
          + FullyQualifiedErrorId : RefArgumentToNonRefParameterMsg
    • Hi again,
      Sorry I didn't enough search. just below I found the answer from Scotty_E I tried as he said with Powershell_ISE(x86) and it worked. now I need to find a way to execute this script in 32 Bits mode with GPO...
      Sorry fo disturb,
    • Or if you want to force running in x86 mode you can follow this blog : http://www.ehow.com/how_12171385_run-only-x86-powershell.html
      Hope that helps,
  • Using this script with Outlook 2010 standalone
    1 Posts | Last post October 06, 2012
    • Hi, 
       Is there any way to get this working without Office 2007/2010. I have a set of Client PCs that only have Outlook 2010 installed; therefore, I don't think the powershell script will work for generating the rtf and html bits for the signature.
      I cannot install Office 2010 on these PCs due to the restricted nature of work at the company I work for. 
  • Some improvement here
    1 Posts | Last post September 15, 2012
    • Hi all, 
      There are some improvement here:
      ************* 1.2 **************
      #    - Fix signature txt format
      #    - Add Variables TelePhoneNumber,description, facsimileTelephoneNumber, mobile, department (line 77-81)
      #    - Add support for OWA, the script now generate the html file by username and copy it on Exchange Server shared Directory for succeeding import (line 64)
      #    - Changed "wdFormatHTML" with "wdFormatFilteredHTML" this last command save only HTML whitout Office TAGs. This is important because Exchange Server support only 8k for OWA Signs.
      #     On Exchange Server share a folder with name "Signatures" and set the write permissions to "Authenticated Users"
  • Great Script, worked as promised, except......
    1 Posts | Last post January 23, 2012
    • the script worked great once I did a find and replace of all of the single and double quotes throughout it. there are ' and " quotes paired with the 6 and 9 shaped curly quotes all though the script. 
      Once that was done, I added things like mobile, fax (facsimileTelephoneNumber), street address, etc to the script and my signatures, worked very well except that when the script parses out the docx into an HTML, anything that is a hyperlink is converted to Times New Roman, which is no good for my signatures.
1 - 10 of 13 Items