Author Posts

January 1, 2012 at 12:00 am

by gretty at 2013-04-30 20:11:08

Hello

I am distributing an installer and it will open and run a PowerShell script. The installer will be used by people who have Windows XP and up.

Am I guaranteed that this script will run/execute on all these versions of Windows? I'm looking for the similar Cross-Windows-Platform interoperability that Batch files provide.

I've heard of the error: "File cannot be loaded because the execution of scripts is disabled on this system" what can I do in this scenario? If a user has disabled scripts does that mean I will need to use a different language(maybe just Batch)?

by DonJ at 2013-05-04 08:57:50

First, no, you are not guaranteed. XP doesn't come with PowerShell, and Vista ships with v1. You would need to ensure that PowerShell (of whatever version you want) is installed.

Second, the error your refer to is because the default execution policy in PowerShell prevents scripts from running. Read the help for the Set-ExecutionPolicy command. Users do not get to enable/disable this; it is an administrator function often managed through a Group Policy object.