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.