Skip to main content

I am working on an orchestration for when users go on leave that will block their logon by editing the “logonhours” attribute in AD to block logon.

I am able to edit other attributes in the custom_attributes field without an issue, but when I go to update logonhours, I get the following error in the screenshot below:

 

In case the picture doesn’t load for anyone, the error is:

The request is not supported At line:1 char:1 + Set-ADUser -Identity 'CN=Test User,OU=************************************************ ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (CN=Test User,OU...s,DC=*********************) *Set-ADUser], ADException + FullyQualifiedErrorId : ActiveDirectoryServer:50,Microsoft.ActiveDirectory.Management.Commands.SetADUser

 

Disabling the user is not an option as it will kick off other automation that will break other things in the domain including their IP phone setup.

 

Is this field not able to be updated through orchestration? Or is there something I am missing here? I have tested on more than just the test user with the same results.

I did find a solution for this, just in case anyone else runs into this.

Using the PowerShell Orchestrator, to block login in AD, use the following payload:

net user {{SamAccountName}} /domain /time:

To re-enable login, the following payload can be used in PowerShell Orchestration:

net user {{SamAccountName}} /domain /time:all

Hope this helps someone!


Reply