Simple Powershell Script to Add the Disabled Date in the Description Field

Simple Powershell Script to Add the Disabled Date in the Description Field

Hello,

I am fairly new to scripting and I am attempting to build a simple PowerShell script to add the date an account was disabled into the description field. I have the script listed in the Disable policy as follows:

powershell C:\ManageEngine\ADManager Plus\bin\SetDescriptionDisabledDate.ps1 -Arg1 %username%

This is what I have for the script:

#Importing Module
Import-Module Activedirectory

#Get Current Date
$str=Get-date -Format d

#Set the description to read the current date the account is disabled

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

AD Manage Engine tells me that the script runs successfully but it fails to enter anything into the Description field.

Any help would be greatly appreciated.

Tom