I have a user that is used to run Powershell scripts, triggered by the Windows task scheduler on a Windows 2012RC2 server. The scripts use specific Snap-ins, which are added at the start of the script.
The scripts fail and when I manually tried to find the root cause of the issue by running a Powershell on the server as said user, I found out that the user is unable to add the snap-in:
asnp <snap-in>
+ asnp <snap-in>
+ ~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (<snap-in>:String) [Add-PSSnapin], PSArgumentException
+ FullyQualifiedErrorId : AddPSSnapInRead,Microsoft.PowerShell.Commands.AddPSSnapinCommand
It works fine if I run the same command in the Powershell as the Administrator.
How do I permit the user to add snap-ins in the Powershell on the server?