Custom Script to write to Description field
Hello All,
Just sharing in the event anyone else needs to do this and is having trouble.
As part of our disable user policy, we run a custom powershell script to write "Diasabled -Month -Year" in the user's description field. ie: DISABLED July 2019
To call the script place this in the custom script command line/box:
powershell .\scriptname %userName% for example: powershell .\disableDescription.ps1 %userName%
The script itself:
- $admgr_user = $args[0]
- #Importing Module
- Import-Module Activedirectory
- $Month = get-date -UFormat %B
- $Year = Get-Date -UFormat %Y
- Set-ADUser -Identity $admgr_user -Description "DISABLED - $Month $Year"
The script is in the bin folder of the ADManager server ie: C\ManageEngine\ADManager PLus\bin\disableDescription.ps1
Hope this helps someone as I was having issues with IO Exception error and it had to do with how you call the script within ADManager: powershell .\script.pst %variable%
Cheers!