Update-DSUser always returning "WebApiRedirectToLogin"

Backlog

Update-DSUser always returning "WebApiRedirectToLogin"

avatar

Hi,

I'm trying to create a script using the devolution PowerShell module to enable or disable user based on a AD group.

But before starting with the major sync part I wanted to test with a user in our test environment and it failings all the time the command "Update-DSUser".

Bellow is the code I'm using to do this, from what I see everything seems to be ok but, maybe I missed something. Can you help me please?

$env:DS_URL= 'https://DVLS.local/dvls'
$DVLSUrl = $env:DS_URL  
$appkey = "XXXXXXXXXXX" 
$appsecret = "XXXXXXXXXXXXXXXXXXXXXX"  
$SecPassword = ConvertTo-SecureString $appsecret -AsPlainText -Force 

$Creds = New-Object System.Management.Automation.PSCredential ($appkey,$SecPassword)
$Response = New-DSSession -Credential $Creds -BaseURI $DVLSUrl -AsApplication

$UserID = $((Get-DSUser -All).data | where {$_.name -eq 'User name'}).id
$enabled = $(Update-DSUser -UserID $UserID -Enabled $true)

The error:

Kind regards

All Comments (7)