
You can use MS Graph to create a user signature. I had written an article about how to deal with signatures in various versions of Outlook . These are fine if you are a small organization. If you are a large organization, you can use Code Two or Exclaimer to do the job. But what if your are in between? This article will show you how to generate a signature using MSGraph and deploy it to a user with ease. Read on!
Steps in Using MS Graph to Create a User Signature
I had originally wrote an article on how to do this using VBSrcipt, however, this will be phased out with later versions of Windows and Windows server. It has served its purpose. Also, it is a little Phishy now (LOL).
Make sure you have permissions to have the scope “User.Read.All” is MS Graph and you can at least administer Entra and you are ready to start.
First, you will need to connect to Microsoft Graph:
Connect-MgGraph -Scopes "User.Read.All"Then, you need to load the data you get from Entra to create the signature into variables. I have included First Name, Last Name, Job Title, Business Phone, Mobile Phone and Email.
$user = Get-MgUser -UserId "user@company.com" -Property givenName,surname,JobTitle,BusinessPhones,MobilePhone
$firstName = $user.givenName
$lastName = $user.surname
$jobTitle = $user.JobTitle
$businessPhone = $user.BusinessPhones[0]
$mobilePhone = $user.MobilePhone
$email = $user.emailAdditionally, you need to load an html document into a variable like this:
$htmlContent = @"
<html>
<body>
<p>$FirstName $LastName</p>
<p>$JobTitle</p>
<p>$BusinessPhone</p>
<p>$MobilePhone</p>
<p>$email</p>
</body>
</html>
"@
Lastly, You create an HTML file with the above information:
Set-Content -Path "C:\Your\Path\Here\Signature.html" -Value $htmlContentIt is easy to use MS Graph to Create User a Signature. The HTML format can be a simple or as complex as you like. I personally like to use an HTML file editing Program to crate the design of the HTML that I like and then put the variables above into it and then paste it into the $htmlcontent variable.
You then can forward this file to your user in question and have them copy and paste it into there Outlook Signature. I find this a good in between when you use MS Graph to Create a User Signature!
