Check user exist in AD with powershell
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-09-2017 01:37 AM
I have a condition to check if user exist in AD so that while rehiring we do not create a new userid for the same user who has a deactivated account and reactivate the same account.
I found ways to to do that via AD activities but that uses LDAP.
I do not have LDAP and want to do the same via powershell script.
Can anyone help how to do that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-22-2017 01:35 AM
{
"hresult": "-2146233088",
"output": "\n",
"errorMessages": "\nCannot find an object with identity: 'F090900' under: 'DC=eu,DC=t-u,DC=outer'.Stack Trace: at Microsoft.ActiveDirectory.Management.Commands.ADFactoryUtil.GetObjectFromIdentitySearcher(ADObjectSearcher searcher, ADEntity identityObj, String searchRoot, AttributeSetRequest attrs, CmdletSessionInfo cmdletSessionInfo, String[]& warningMessages)at Microsoft.ActiveDirectory.Management.Commands.ADFactory`1.GetExtendedObjectFromIdentity(T identityObj, String identityQueryPath, ICollection`1 propertiesToFetch, Boolean showDeleted)at Microsoft.ActiveDirectory.Management.Commands.ADGetCmdletBase`3.ProcessRecordOverride()at Microsoft.ActiveDirectory.Management.Commands.ADCmdletBase.ProcessRecord()\n",
"eccSysId": "e02d42766f74c30005360519ea3ff4ea",
"tags": {
"__text__": "\n"
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-09-2017 07:36 AM
Hi Avani,
For using AD and powershell you want to have LDAP present in the instance.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-22-2017 01:51 AM
I checked the discussions on the form and it seems to be a credential issue. Check the below discussion:
To add/remove users into an Active Directory group
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-22-2017 02:21 AM
But since it is working fine when user exist, how can it be a credential issue.
Its just that when IF is not working, it is not going in else.