How to find if user exists in LDAP

Indup
Tera Expert

Hello guys,

I have designed a catalog item with two variables. User Name (type: string) and Password (type: password)

I have attached a workflow and using custom activity to reset a password for the user selected. If i enter a user which is not existing in LDAP then Output should be thrown error. How to know whether the user exists in ldap or not in service now?

 

 

Regards,

Indup

 

5 REPLIES 5

Sandeep132
Kilo Sage

Hi,

If you are importing user information via LDAP sync you can find "Source" field populated on the sys_user table. You can utilize this source field to check if user exists in LDAP or not. Source field on user table looks like "ldap:uid=userid,ou=users,dc=companyname,dc=com"

Thanks

Ankur Bawiskar
Tera Patron
Tera Patron

@Indup 

you should use Query AD activity in workflow before updating the user password

pass proper variables to this activity and based on success or failure use next activity of Update

Query AD activity

A guide to processing the output of Query AD activity and understanding of the changes to the output...

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Hello Ankur,


I already installed mid Server on Ansible to run the Script from Service now to Ansible I need 2nd Mid Server on Windows to run powershell script from Service now to Windows Instance But To Run Any script through Mid Server there is a option called Default Server in Service now where at time I can set only 1 Mid server!!

So if I add this custom powershell activity in my main workflow also the other custom activity which has then Ansible script will not run because the Mid server status for it is Up, but not set to Default Server. 
So you understand right? In the first Powershell activity, i am trying to find the selected user exists in LDAP or not. In the Second Custom Activity, i am trying to reset his password in LDAP.
 
 
 
Regards,
Indup

Ashutosh Munot1
Kilo Patron
Kilo Patron

HI,

We have to use powershell activity for that and we need to know the domain controller for this. Permissions required are read atleast so you know if the user exist or not.


We implemented this by using new or custom PS script and with new activity same like query AD>


Thanks,
Ashutosh