Outlook signature based on user information from Active Directory

Create Outlook signature based on user information from Active Directory.

 
 
 
 
 
(10)
Add To Favorites
Office
11/21/2010
E-mail Twitter del.icio.us Digg Facebook
Sign in to Ask a Question


  • 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?
      
      Thanks,
      
      Simon
  • [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?
      
      Thanks,
      Simon
      
      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
      xt)
          + 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,
      
      Simon
    • 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. 
      
      Thanks
      
      Regards,
      Jon
  • 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"
      
      http://translate.google.it/translate?sl=it&tl=en&js=n&prev=_t&hl=it&ie=UTF-8&layout=2&eotf=1&u=http%3A%2F%2Fwww.andreagallazzi.com%2F2012%2F09%2Ffirma-di-outlook-e-owa-basata-sulle.html
      
  • Folder Signatures
    2 Posts | Last Post September 01, 2012
    • 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.
      
      And,
      
      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.
      
  • 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.
  • Error running powershell command
    1 Posts | Last Post December 12, 2011
    • hi, i recieved the following error when i try to run the command on powershell.
      
      PS C:\Users\Administrator> {Set-ItemProperty $CompanyRegPath'\Outlook Signature Settings' -name ForcedSignatureNew -Value $ForceSignatureNew}
      Set-ItemProperty $CompanyRegPath'\Outlook Signature Settings' -name ForcedSignatureNew -Value $ForceSignatureNew
      PS C:\Users\Administrator>
      PS C:\Users\Administrator> if ($ForcedSignatureReplyForward -eq $ForceSignatureReplyForward){}
      PS C:\Users\Administrator> else
      The term 'else' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
      At line:1 char:5
      + else <<<<
          + CategoryInfo          : ObjectNotFound: (else:String) [], CommandNotFoundException
          + FullyQualifiedErrorId : CommandNotFoundException
      
      
      
      
  • Problems with $MSWord.Documents.Open($fullPath)
    1 Posts | Last Post November 25, 2011
    • Hi Jan
      
      I've changed and implemented the script for test, an production on some users, so the signature file is updated every time the users is logged on.
      But i've had many issues in my helpdesk about different errors when users is starting outlook right after logon.
      
      I've tried executing the following lines on my Windows 7 Client.
      $MSWord = New-Object -com word.application
      $fullPath = $LocalSignaturePath+"\"+$CompanyName+".docx"
      $MSWord.Documents.Open($fullPath)
      
      When i execute the last line to open the .docx document i've noticed it starts outlook.exe ....?
      I'm guessing its something about the word.application COM Object but i dont get it?
      
      Does anyone else have similar problems?
      
      Regards Simon
  • Correcc
    14 Posts | Last Post June 09, 2011
    • Hi,
      This is a wonderful script, but I report an error that I was shown in the following line:
      
      #Stamp registry-values for Outlook Signature Settings if they doesn`t match the initial script variables. Note that these will apply after the second script run when changes are made in the 
      
      "Custom variables"-section.
      if ($ForcedSignatureNew -eq $ForceSignatureNew){}
      
      
      I wonder if this correct or should be as follows:
      
      #Stamp registry-values for Outlook Signature Settings if they doesn`t match the initial script variables. Note that these will apply after the second script run when changes are made in the "Custom variables"-section.
      
      if ($ForcedSignatureNew -eq $ForceSignatureNew){}
      
      
      Tks.
    • Same for:
      
      #Insert variables from Active Directory to txt signature-file
      (Get-Content $LocalSignaturePath'\'$CompanyName'.txt') | Foreach-Object {$_ -replace "DisplayName", $ADDisplayName -replace "Title", $ADTitle -replace "TelePhoneNumber", $ADTelePhoneNumber 
      
      -replace "EmailAddress", $ADEmailAddress} | Set-Content $LocalSignaturePath'\'$CompanyName'.txt'
      
      Should be:
      
      #Insert variables from Active Directory to txt signature-file
      (Get-Content $LocalSignaturePath'\'$CompanyName'.txt') | Foreach-Object {$_ -replace "DisplayName", $ADDisplayName -replace "Title", $ADTitle -replace "TelePhoneNumber", $ADTelePhoneNumber -replace "EmailAddress", $ADEmailAddress} | Set-Content $LocalSignaturePath'\'$CompanyName'.txt'
      
      --
      I have 2 problem now:
      
      - The logo used in the template wont appear (empty square)
      - Even enforced, the sign are not applied by default
      
      Outlook 2003 on 2008 R2 RDS
      
      
    • The script has been improved by Darren Kattan, and are now re-published.
      For information about the improvements, see the following blog-post:
      http://www.immense.net/deploying-unified-email-signature-template-outlook
      
      Thanks Darren!
    • A snappy script indeed! However I am struggling how to load the correct office assembly that the script is looking for. I am running Office 2007 (x86) on a Win7 x64 platform.
      
      The errors that I recieve relate to the $saveFormat routines. 
      
      --------------------------------------------------------------------------------
      Unable to find type [Microsoft.Office.Interop.Word.WdSaveFormat]: make sure that the assembly containing this type is loaded.
      At C:\temp\EmailSignature2011\Set-OutlookSignaturev2.ps1:173 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:\temp\EmailSignature2011\Set-OutlookSignaturev2.ps1:180 char:59
      + $MSWord.ActiveDocument.saveas([ref]$path, [ref]$saveFormat <<<< )
          + CategoryInfo          : InvalidOperation: (saveFormat:Token) [], RuntimeException
          + FullyQualifiedErrorId : NonExistingVariableReference
      ------------------------------------------------------------------------------------
      
      Any hints appreciated!
      
      
    • You could try to download and install the Primary Interop Assemblies for Office 2007 to see if that resolves the issue.
    • Doh!
      
      Worked out what my issue was...
      
      Even though I had all the Pre-Reqs installed for office etc (note x86 Office, x64 Win7 OS), the script was unable to find the interop libraries because I was running/testing the script from the native 64-bit powershell editor. The same errors occured when testing my script via a BAT file from the native cmd.exe
      
      As soon as I opened the x86 powershell_ise.exe from "C:\Windows\SysWOW64\WindowsPowerShell\v1.0" and ran the script from there it worked. Similarly, opening x86 CMD.exe from "C:\Windows\SysWOW64\" and running my batch file worked as well. Obviously having a x86 installion of office caused the issue.
      
      Since im going to deploy this script via SCCM, this wont be a problem for me as SCCM is a 32bit application, so will trigger the 32bit powershell exe.
      
      I hope someone thats having a similar issue to me stumbles across my post and finds the answer alot faster than I did
      
      Thanks again for an awesome script guys!
      
      - Scott.
    • I was wondering if there was a way to add the fax lines to the script.  we have some people with their own personal faxes?
    • Magnus: You can use $ADUser.facsimileTelephoneNumber if the fax-number is defined in Active Directory.
    • how can i turn off the check for last updated so it will run the full script each time its run?
    • You can remove the following lines to disable the version check:
      109
      110
      111
      167
    • excellent thanks.
      the other issue i'm getting is running the script from a normal user account. i'm using the vbscript to call the powershell script file but i get the error *.ps1 cannot be loaded because the execution of scripts is disabled on this system. under my admin account the executionpolicy is set to unrestricted but checking user my normal user account it says restricted. if i put this script in a gpo to run at login it wont run because of this. is there a fix for this? even if i can set for all users the executionpolicy to unrestricted would do the trick but even if i try that from an elevated powershell it complains that i don't have access to the reg key. HKLM\software\microsoft\powershell\1\shellids\microsoft.powershell.
      any help would be appreciated.
      regards 
    • You could either configure the exectuion policy via GPO (User Configuration) or alternatively launch powershell.exe with the parameter -executionpolicy bypass
    • if anyone wants to change it to check when the users account was updated last instead of when the signature template file was last modified.
      add in "$ADMofidy = $ADUser.whenChanged" with the rest of your ad variables.
      change "$SigVersion = (gci $RemoteSignaturePathFull).LastWriteTime" to be "$SigVersion = $ADMofidy"
      leave everything else and your script will check when the user account was last updated.
      
    • i was wondering if there was an quick and easy way to remove signatures? i'm running multiple sigs and i can get it to create another sig but its not setting it as default. if setting at default works it wouldn't be too much of a problem but it would still be nice to remove the sig to keep it clean and not have too many options there for the user.
      i did just have a brainwave i could have the same doc name so the new sig overwrites it.