Powershell Generate Outlook Signature
Jump to navigation
Jump to search
Needed to create a standard signature for everyone. This generates the basic framework, but there is more work to be done. Still need to create the html version with formatting.
A base file should be created similar to the following. Though not necessary, it will make it easier to modify the base template if someone complains about placement.
- USERNAME COMPANY TITLE PHONE
$ErrorActionPreference='silentlycontinue' $users=get-aduser -Filter {(Enabled -eq "True") -and (mail -ne "$NULL")} ForEach ($i in $users) { $userinfo=get-aduser -Identity $i -Properties mail,telephoneNumber,Title,company | select telephoneNumber,Name,Title,company $name=$userinfo | select -ExpandProperty name $filename=$name -replace " ","." $title=$userinfo | select -ExpandProperty title $email=$userinfo | select -ExpandProperty mail $phone=($userinfo | select -ExpandProperty telephonenumber).insert(6,".").insert(3,".") $company=$userinfo | select -ExpandProperty company #echo $name $file=Get-Content C:\test\basesig.txt $file -replace 'USERNAME',$name -replace 'TITLE',$title -replace 'PHONE',$phone -replace 'COMPANY',$company | Out-File c:\test\"$filename"_sig.txt } Remove-Variable userinfo Remove-Variable name