Powershell scripts not editting attributes

Powershell scripts not editting attributes

We have a number of powershell scripts which are called as part of the automation policy.

I can see in the logs that the script calls correctly and adds the %username% correctly but the actions never complete. If I go directly to the server and run these scripts with the parameter at the end it will complete the action.
It seems this is the case for multiple scripts but other scripts that work fine. The ones that work ok seem to be get- powershell fucntions, the ones that fail are set- functions.

Script example is as follows:
Custom script dialog box:
powershell E:\Scripts\remove-manager.ps1 %username%

Actual Script:
$param1=$args[0]
Set-ADUser $param1 -Manager $null

Says is completed in the automation history, but the actual command looks like its never run.
Works fine if i run it from powershell