Monthly Archives: January 2013

SCSM2012: Howto customize forms to show email address populated form active directory

You might have seen that there is not a simple way to get the email address to the incident form or any form in service manager 2012. I don’t know why Microsoft did’nt just create a class that has the but it’s not there.

In my case i created a powershell script to update the CI of the user and i have chosen to add the email address to the notes field (i had to use a current field beacuse if i added a new the forms could not read from that field). There might be some better ways to do this but it works fine for me.

Extend the form
First thing to do is to add a field called email somewhere on your form. Se picture below.

If you are doing the same as me you need to change the binding of the field to affectedUser.Notes

Configure the powershell script
Create a powershell script on your ServiceManager managementserver. Now copy the code below. I will try to explain the code abit.

We first get the Microsoft.AD.User class and save it to the variable $UserCI. Now we loop thru all the users and get the emailaddress and saves it to ADUser variable. Now we compare if the CI.Notes have the same as the directory. If it’s empty we save the new email using Update-SCCLassInstance

$UserCIs = Get-SCClassInstance -class (Get-SCClass -name 'Microsoft.AD.User')
foreach ($UserCI in $UserCIs)
$ADUser = Get-ADUser -Filter "SamAccountName -eq '$($UserCI.UserName)'" -Server -Properties EmailAddress
if ($UserCI.Notes -ne $ADUser.EmailAddress) {
$User = "UserName -eq $($UserCI.UserName)"
Get-SCClassInstance -class (Get-SCClass -name 'Microsoft.AD.User') -filter $User | %{ $_.Notes = $($ADUser.EmailAddress); $_ } | Update-SCClassInstance



Now set the script to run once each day or more if you need it to. And import the management pack you created for the form and it should look something like the picture below when you search for a user.

System Center 2012 SP1 hits Volume licensing service center

Good news for everyone that don’t have a technet subscription or a MSDN subscription. System Center 2012 SP1 are now available on the volume license portal. So start the lab and go have some fun with SC2012.