AD Object Update Error

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2023 11:39 PM
Hi Developers
I am getting the following error when trying run orchestration flow to add users to an AD group. But it doesnt occur always. For sometimes only. Identity is set to the Group but in error "kalc098" is the user id(current.variables.requestor_id).
Thats what confuses me. Group name is set by an on load script.
Following is the code and error. Thanks in advance!
import-module "ActiveDirectory"
$User = "${current.variables.requestor_id}"
$Group = "${current.variables.ad_group}"
Add-ADGroupMember -Identity "$Group" -Members $User -credential $cred -Server "aaaa" -confirm:$false
$Members = Get-ADGroupMember -Identity $Group -Recursive -Server "aaaa" | Select -ExpandProperty SamAccountName
AD Object update Error: [object Object] *** Cannot find an object with identity: 'kalc098' under: 'DC=na,DC=sysco,DC=net'.HRESULT: [-2146233088]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.GetDirectoryObjectFromIdentity(T identityObj, String searchRoot, Boolean showDeleted)at Microsoft.ActiveDirectory.Management.Commands.SetADGroupMember`1.ValidateMembersParameter()