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

Get SCCM site roles using Powershell

You can run the following on the site server to find out the servers holding each SCCM role: $SMSProvider = get-wmiobject sms_providerlocation -namespace root\sms -filter “ProviderForLocalSite = True” $SiteCode = $SMSProvider.SiteCode $ProviderMachine = $SMSProvider.Machine get-wmiobject -Class SMS_SystemResourceList -NameSpace root\sms\site_$SiteCode -Computername $ProviderMachine | format-list RoleName,ServerRemoteName,SiteCode

Haven’t been able to blog lately

I haven’t been able to blog lately. I have started my new job as a SCCM specialist. I know this blog is mainly focusing SCCM, SCOM and Powershell and so far I have not posted anything SCCM related. So hopefully I will start posting more SCCM related topics.

%d bloggers like this: