I never could find a solution to make Rocket.Chat automatically disable users when the AD user is disabled, so I just added this to my PowerShell script that I already use to disable AD users. It will deactivate the Rocket.Chat user for me:
$user = "your_username_here"
$Headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$Headers.Add("X-Auth-Token", 'my-auth-token')
$Headers.Add("X-User-ID", 'my-user-id')
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$response = Invoke-RestMethod -Headers $Headers https://my.chatserver.com/api/v1/users.list
$RC_id = ($response.users | Where-Object {$_.username -eq "$user"})._id
$body = @{
userId = "$RC_id"
data = @{
"active" = $false
}
}
$body = $body | ConvertTo-Json -Depth 2
$DisableResponse = Invoke-RestMethod -Headers $Headers https://my.chatserver.com/api/v1/users.update -Method Post -Body $body -ContentType 'application/json'
Maybe this will help you too.