Outlook signature based on user information from Active Directory

Create Outlook signature based on user information from Active Directory.

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

  • How to do it with OWA users?
    1 Posts | Last post May 19, 2017
    • Greetings.
      Thanks Jan for the script, it works for me with some particular modifications, but very good.
      However, how to perform this task but for users who only use OWA? Say for example those who have K1 license.
  • Conditional formatting
    1 Posts | Last post May 24, 2016
    • Hi.
      Great script, but I'm wondering if it's possible to format the script based on which AD attributes is available to work With.
      I.e. we have
      <Zip>, <City>
      <Telephonenumber> / <Mobile>
      But when an employee doesn't have the mobile phone Field populated the signature will look weird With a / trailing the telephonenumber.
      Is it possible to, in some way, say that if($mobilephone -eq "") {#do this} else {#do that}
  • Office 365 2013.
    1 Posts | Last post January 03, 2016
    • I use Office 365 pro plus version of Office 2013 and the script create only DOCX file and for rtf, HTM and text not created, please help. 
  • TXT Signature is not fully working
    2 Posts | Last post July 17, 2015
    • 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?
    • DanKnowsIT answered this issue above.
  • Outlook \ Word 2013
    4 Posts | Last post July 17, 2015
    • 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)
    • Thanks Dan, that worked a charm
  • 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...
  • 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
  • [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,
1 - 10 of 16 Items