kelloti
kelloti

Reputation: 8951

Powershell script fails when run via nant

I have several team members who can't run powershell scripts via nant. When they do, they get the ExectutionPolicy (not high enough, still set at the default value). However, they've run Set-ExecutionPolicy RemoteSigned in a powershell console, and they can run the powershell scripts directly. Any ideas about what's going wrong?

Upvotes: 3

Views: 861

Answers (1)

Keith Hill
Keith Hill

Reputation: 201952

If they are running on a 64-bit machine, have they set the execution policy for both 32-bit and 64-bit PowerShell? It could be that they set the policy for 64-bit PowerShell and NAnt is firing up 32-bit PowerShell (or vice-versa). Another way to work around this if you're on at least PowerShell 2.0 is to set the policy when invoking PowerShell e.g.:

PowerShell.exe -ExecutionPolicy RemoteSigned ...

Upvotes: 4

Related Questions