pat302003 Formation Lap
Hello,

I've created a Powershell script that run only on successful user creation. I need to pass the newly created username to this script in the command line using a variable. Is there a way I can pass the newly created user account values to my Powershell script? I've tried %USERNAME% but that it's not working. My script works perfectly when it's executed outside of ADManager but not when it's run by ADManager. I guess it's because I'm not using the right variable.

Thanks

Replies (4)

Hello Pat,

%username% would be the right variable. Kindly touch base with us on support@admanagerplus.com to assist you better on this. 

#TheAD+Experience

Shane Clinton
ManageEngine ADSolutions Team
Direct
: +1 408-916-9891

Toll Free
: +1888-720-9500          
How To | Forum | File Permission Management
   
ADManager Plus | ADAudit Plus | ADSelfService Plus | Exchange Reporter Plus | Recovery Manager Plus | AD360
 


pat302003 Formation Lap
It's now working. Here is the command Line:

Powershell -ExecutionPolicy Unrestricted C:\ManageEngine\Scripts\set-OtParam.ps1 %username%

Thanks
Nenad Bojovic Formation Lap
Still not working for me - i have tried everything - script executes but parameter is not passed. I'm trying to remove manager via script on disable account page.

In AD manager
c:\windows\system32\windowspowershell\v1.0\powershell.exe -ExecutionPolicy Unrestricted "c:\manageenginescripts\removemanage.ps1" %username%

Powershell script

param($Arg1)
Set-ADuser $Arg1 -manager $null


running script using same command from CMD promt (running as manageengine account) works fine and manager is removed. Running it from ADmanager does not work.

Any ideas?

I have contacted your online support and have been left hanging dry.

Thanks


Scott Employee
Hi Nenad,

Thanks for your response provided on the below topic.


Happy to find out that the query was resolved on call by our support team.

ADManager Plus Team 
Toll-Free:+1888-720-9500 
Email: support@admanagerplus.com 
ADManager Plus - Active Directory Management & Reporting Software