After upgrading our Windows servers to Windows 2019 and updated Autosys agent to align with the compatibility matrix.
Since this upgrade, we get an access denied with the command Import-Module ActiveDirectory:
Import-Module : Win32 internal error "Access is denied" 0x5 occurred while reading the console output buffer. Contact
Microsoft Customer Support Services.
At D:\folder123\Autosys\test\Delete-Users.ps1:66 char:1
+ Import-Module ActiveDirectory -verbose
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ReadError: (:) [Import-Module], HostException
+ FullyQualifiedErrorId : ReadConsoleOutput,Microsoft.PowerShell.Commands.ImportModuleCommand
runs : The term 'runs' is not recognized as the name of a cmdlet, function, script file, or operable program. Check
the spelling of the name, or if a path was included, verify that the path is correct and try again.
At D:\folder123\Autosys\test\Delete-Users-xxxx.ps1:69 char:1
+ runs
+ ~~~~
+ CategoryInfo : ObjectNotFound: (runs:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
This error occurs only when the command is executed through Autosys.
We tried several execution mode with the same account on the same server:
Release : ANY
Component : Workload Automation Agent
Added following agent parameter in the agent's agentparm.txt file;
oscomponent.su.newconsole=true
Restart the agent for the change to take effect..
oscomponent.su.newconsole
(Windows only) Sets whether to force the agent to create a console when running a Windows job.
Default: false