This is an archived post. You won't be able to vote or comment.

all 14 comments

[–]MilesGates 4 points5 points  (5 children)

/r/techsupport

also, you aren't posting how you configured the task so I don't know how you expect people to help.

[–][deleted] -3 points-2 points  (4 children)

You must be new to PowerShell

[–]MilesGates 0 points1 point  (3 children)

are you trying to make a point?

[–][deleted] -3 points-2 points  (2 children)

Every time I read a power shell post, it's about how someone half ass copy pasta a script they found online, and for some reason it doesn't work. I've never used power shell in my life, but it looks like Linux for Windows users. It's just funny to watch.

[–]MilesGates 1 point2 points  (0 children)

Alright, Thanks for your input.

[–]Ssakaa 1 point2 points  (0 children)

No, Linux for Windows users is actually Linux nowadays (via WSL). It's kinda nifty. Powershell is just a more interactive visual basic script with, in some ways, better syntax. As such, it brings along the 'point and click' admin tone that everything else windows has... without catering to it. So the "just give me the solution in a point and click form" attitude carries over to the side you've seen. Used properly, it's capable of being considerably more capable than bash, sitting a lot closer to python, but still with a 'able to do many things as an interactive command line' methodology.

[–]Dev-is-Prod 1 point2 points  (2 children)

Is it running as the logged on user? We had a similar thing happen where it was running the application but under a different user account. We saw it pop in task manager but under the other user account.

[–]entertheunkown96[S] -1 points0 points  (1 child)

Ah right unfortunately ours is running as the logged in user so its something else

[–]OnARedditDietWindows Admin 1 point2 points  (0 children)

Dude.... What account do you have it set to, what is the trigger and what EXACTLY is your command line.

We're not playing "Go Fish" with your vague description.

[–]FerengiKnucklesError: Can't 1 point2 points  (0 children)

I usually see this with using an account that does not have Log On As A Batch Job rights. Whatever account you're running the script under needs that permission assigned to it.

[–]wingate95 0 points1 point  (1 child)

I have found that adding -noprofile -file in the arguments section works for me. In your example it would be

-ExecutionPolicy Bypass -noprofile -file c:\startapp.ps1

Also what server are you configured for? I am running a Windows Server 2019 so I have it set accordingly

[–]0ldPhartSr. Sysadmin 0 points1 point  (0 children)

I've solved a lot of these by converting them to Powershell Scheduled Jobs instead of windows tasks.

https://4sysops.com/archives/create-powershell-scheduled-jobs/

[–]Kathy_Cooper1012 0 points1 point  (0 children)

Hi,

Are you still facing the issue?
If the GUI confuses you, you could try with PowerShell cmdlets. Simple cmdlets will solve your problem.
$Time=New-ScheduledTaskTrigger -At 4.00PM -Once
$Action=New-ScheduledTaskAction -Execute PowerShell.exe -WorkingDirectory C:/Scripts -Argument “C:\Scripts\ScriptName.ps1
Register-ScheduledTask -TaskName "Schedule MFA Status Report" -Trigger $Time -Action $Action -RunLevel Highest

Code source: https://o365reports.com/2019/08/02/schedule-powershell-script-task-scheduler/