Failed to run PowerShell script via Task Scheduler on a 64 bit Windows

I came across a situation the other day that on a Windows Server 2008 R2 box, when I created a Scheduled Task to run a Powershell script, it runs OK using “C:\Windows\System32\WindowsPowerShell\v1.0\Powershell.exe” (64 bit PowerShell) but fails with error code (0x1) if I use “C:\Windows\SysWOW64\WindowsPowerShell\v1.0\Powershell.exe” (32 bit Powershell) I have done the following steps to help me troubleshoot the issue. 1. I have changed the scheduled task to “Run only when user is logged on” so a command prompt was shown when the task runs. I screen captured the output: It looks like the PowerShell Execution Policy is preventing the

Windows Scheduled Tasks inventory – Using PowerShell

I originally posted this script here. It is to audit and inventory all scheduled tasks created for all windows computers under a specific OU in AD. It has become useful for me again this week while I was working on a client’s SCOM environment. This particular client had no control over scheduled server reboots and they are not using SCOM Maintenance mode at all. Therefore there are a lot of SCOM alerts generated… This script came in handy and it’s a good starting point to get all scheduled tasks and find out which ones are causing servers to reboot so

%d bloggers like this: