Add a transcript to the script so that you can see the errors that Powershell generates.
Start-Transcript -path C:\Logs\MyScriptLog.txt
.... the rest of your script
Stop-Transcript
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I am working on a script that takes a list of DIDs/GUIDIds from a locally stored file generated by another script. It then removes the listed devices from Active Directory. But it won't run as a scheduled task.
The Last Run Result status is 0x1. Which as far as I can tell is a vague catchall value meaning "I can't". There is nothing in the History tab at all.
I am logged in with the account that will be used to run task in the Task Scheduler. I've already delegated delete device permissions to the account that will run the script, and it currently completes without error when I run it manually in ISE. During the manual runs I am using the -whatif parameter, so that I don't lose the devices that the first script found. But that shouldn't affect the result when running it without the parameter in a scheduled task.
The Task Scheduler logs show task started>action started>action completed> task completed. The PowerShell logs show PowerShell Console Startup>PowerShell Named Pipe IPC>PowerShell Console Startup. There are no events after PowerShell Console Startup.
Add a transcript to the script so that you can see the errors that Powershell generates.
Start-Transcript -path C:\Logs\MyScriptLog.txt
.... the rest of your script
Stop-Transcript
This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.
Comments have been turned off. Learn more