Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Basic question about Powershell and Task scheduler

$
0
0

Hi,

I wrote a script which is working very well when I launch it manually.

But, when I tried to launch it through task scheduler it is not working.

I understood that in fact, I just can't do a simple "Get-ADuser" or another basic command through the task scheduler. But these commands work fine when I execute them into a powershell console or in a file script launched manually. 

For information, I am on MS Windows 2012 R2 server.

My DCs servers (and all of them) are also on 2012 R2.

The script is not on DC server.

My task in the task scheduler is configure like this :

Launched with the domain administrator.

And "Action" tab :

Program : powersshell

Argument : -noprofile -executionpolicy Unrestricted -file "pathtomyscript\script.ps1"

I precise that it's only Acitve Directory commands which are not working.

Did I missed something ?


Viewing all articles
Browse latest Browse all 6937

Trending Articles