Custom Script not working

Custom Script not working

I have a custom script that does the following:

param ($param1)
Add-ADGroupMember -Identity VPNUsers -Members $param1


in the custom script field I have:
C:\ManageEngine\Scripts\add2group.ps1 %username%

The response to the user creation action states:
Custom script result : Success

and the log states:

[11:19:09:074]|[03-06-2020]|[ADMangLogger]|[INFO]|[119]:  CustomScriptDetails: {IGNORE_WARNING=false, SCRIPT_COMMAND=PowerShell -file add2group.ps1 'T2atest', SCRIPT_ENABLED=true, MAX_WAIT_TIME=5}|

But the user is not added to the group. When i run this manually from the ADManager server it works

                New to ADSelfService Plus?