Link to home
Start Free TrialLog in
Avatar of anumoses
anumosesFlag for United States of America

asked on

power shell script in a batch file- not running on windows 7 professional when set as schedule task

I think we have security issue when I schedule as task in the windows environment.

I tried to us

Powershell -noprofile -executionpolicy bypass -file "F:\test\upload.bat" but this only works if its .ps1.

Attached is the batch script. Can someone help?
Avatar of footech
footech
Flag of United States of America image

When you're trying to initiate a batch file (whether from the task scheduler or otherwise), you don't do it with powershell.  Your scheduled task only needs the batch file as the action (i.e. "F:\purple_top\upload.bat"), nothing else.  The fact that your batch file runs a powershell command inside of itself has no impact on this.
Avatar of anumoses

ASKER

Since I have a power shell script in the batch file, I am having a problem. The scheduled task runs but does not do what the script is supposed to do. Its does not transfers the file to the server location. I thinks it  because of windows security policy that power shell has issue with. I want to by pass that security before the batch file come to the powershell.exe line.
ASKER CERTIFIED SOLUTION
Avatar of footech
footech
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
thanks. Put in a new question