Home > Forum > Actions > [solved] Active Directory Contact

[solved] Active Directory Contact
0

Hello,
is it possible to create an Active Directory “contact” (not user) with an action or in any other way.

Although I haven't personally tried it, you might consider using a PowerShell script to create a new object in Active Directory.

Microsoft Copilot suggested the following code:
--BEGIN --

# Define the parameters for the new contact
$contactName = "John Doe"
$displayName = "John Doe"
$path = "OU=Contacts,DC=example,DC=com"
$mail = "john.doe@example.com"

# Define user credentials
$credential = New-Object System.Management.Automation.PSCredential($username, $password)

# Create the new contact
New-ADObject -Name $contactName -Type contact -Path $path -OtherAttributes @{'displayName'=$displayName; 'mail'=$mail} -Credential $credential

Write-Host "Contact $contactName created successfully."

-- END --

Please note that $username and $password should be defined in the action configuration (see attached screenshot).

I haven't tested this code myself, but I wanted to share the idea of using a PowerShell script.

Best.

Privacy overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognizing you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.


To see a full list of the cookies we use and learn more about their purposes, visit our Privacy Policy.