Hi,I can use this ps script to del snapshot.But I added the script to the task schedule and only saw PowerShell running in the process, but the script is not running
one way to check if the problem is with the script or the task configuration is to replace this script with a simple script, may be a folder creation in a script and see it executes with the same task.
Another tip here is to avoid multiple Get-Vm usages, do it once and save it in a variable and use variable after that.
Did you check the task schedulers log for the task? Did you try to replace the code of the script with something simple like a file or folder creation as already recommended before? Did you try to add -EP Bypass and -NoProfile to the arguments of the task?
If it runs from there fine, something else is wrong with your task. I am guessing it may be related to your ExecutionPolicy. Just noticed Olaf suggested the same