AD Manage Engine is Not Passing Variable to Powershell Script

AD Manage Engine is Not Passing Variable to Powershell Script

Hello,

I have built a script to set the Description field to read "MM/DD/YYY Disabled" once a user's account has been disabled via the Disable Policy.

The script as I have written:

SetDescriptionDisabledDate.ps1

Import-Module ActiveDirectory

param($Arg1)

$Str Get-date -Format d

Set-ADUser -Identity $Arg1 -Description "$str Disabled"

The command in the Disable Policy is as follows:

Powershell -ExecutionPolicy Unrestricted C:\ManageEngine\SetDescriptionDisabledDate.ps1 -$Arg1 %SAMAccountName%

Unfortunately, it seems that AD Manage Engine will not pass the variable to the script.

I have also tried %UserName%.

Any help getting this to work would be greatly appreciated.

Tom Gibson





                New to ADSelfService Plus?