Deleting a Named User - Error 400: COM_0018 User does not exist or is inaccessible

481
0
02-23-2023 03:22 PM
AnthonyRyanEQL
Occasional Contributor III

Hi all,

I'm writing a powershell script to delete enterprise named user (SSO via SAML provider) from Portal 10.8.1 using various REST API endpoints (eg. sharing/rest/generateToken, sharing/rest/community/users, sharing/rest/community/users/xxxx/provisionedListings, sharing/rest/community/users/xxxx/delete) and deleting them from AD groups as well.

The script is working in generating a token, find the user, checks the user entitilements (eg. Utility Network extension), remove the entitlement from the user, are they a member of a group, etc.

The part that's failing is trying to remove/delete the user which is where this error is coming from.

The user that generates the token is an Administrator and can delete users via Portal's UI

 

This is my section of code that tries to remove the user

$body = @{
    token=$token
    f="json"
}
$response = Invoke-WebRequest -Uri "$baseUri/sharing/rest/community/users/$nameuser/delete" -Body $body -Method "POST"

 

Has anybody come across this issue before? Thanks

Tags (3)
0 Kudos
0 Replies