Closed Herlevsen9 closed 3 years ago
Hi @Herlevsen9. Which property/field are you referring to for samaccountname/username?
We are trying to implement Avecto/BeyondTrust integration to ServiceNow, which uses this module to create ServiceNow incidents from powershell.
BeyondTrust uses a function Get-PREnvironmentVariable -Name 'UserName'
to get current user/caller, which is then parsed into
$snUserQuerySplat = @{
user_name = $dpUsername
}
Get-ServiceNowUser -MatchExact $snUserQuerySplat
Your question made look at the documentation and code again, and I might have a solution.
Can Get-ServiceNowUser
take SamAccountName (ActiveDirectory) as input ? instead of email (being used as ServiceNow User ID)
Sorry for the delay, I didn't see any notification come through. You should be able to use any field with -MatchExact
or -MatchContains
, just need to know the field name. If unsure of the field name, add it to the filter query in the SN GUI, then right click on the filter breadcrumb at the top and select copy query. That will give you the field name.
Thank you for your input and help. I got it working now.
Can a SerivceNowIncident be created by referencing the "SamAccountName" field instead of the "username" :question:
I have a environment, where username syntax changed a few years ago, so old users have "Lastname.Firstletter Of Firstname" as SamAccount, and their username/email cannot be pulled by powershell when creating a ticket. New users have "firstname.lastname" as SamAccountName and "firstname.lastname@domain.com" as username.
Thank for the great functions.