I have a issue with Powershell and task schedule
Hello in My Windows Server 2012 i was configuring a task schedule to run a Powershell file that operate something inside the Microsoft VMM. It was working perfect,
Action 1- Running the command
Action 2- Deleting the file
Now i imported this task into Windows 2016 after i Upgrade the Windows and its not working its only run the file but delete is not working only the run work and if i arranged the actions and make the delete first its working without any problem, There is something preventing the file from delete action.
This is my Task Schedule Config
General Tab:
[*] run whether user logged in or not
Configure for [ Windows Vista, Windows Server 2008 ]
[*] run with highest privileges
Actions:
[1] First action that run the file
Action: Start a program
Program: C:WindowsSystem32WindowsPowerShellv1.0powershell.exe
Argument: .*.ps1
Start In: E:commandFast_Commands
[2] Second action that delete the file
Action: Start a program
Program: C:WindowsSystem32WindowsPowerShellv1.0powershell.exe
Argument: Remove-Item ".*.ps1"
Start In: E:commandFast_Commands
==============
Last thing when i choose [[*] run only when user is logged in] its working without any problem and all actions is done, Iam sorry if something not cleared i wish i could know the problem and thanks in advance.
My observations: I am not sure why you are using .*.ps1 in both the cases.
But still if the remove is not working , I would request you to use -Force . Are you running the task with highest privilege? . If not please consider that also.
I would like you to check the history of the task also in order to see the error or if the task is failing. Requesting you to provide screenshots also.
链接地址: http://www.djcxy.com/p/38948.html上一篇: 如果错过了,尽快运行任务