aspnetcore icon indicating copy to clipboard operation
aspnetcore copied to clipboard

kvmsetup.cmd fails due to restricted execution policy

Open bricelam opened this issue 12 years ago • 3 comments

When the Kvm-Global-Setup function elevates, the execution policy set in kvm.cmd is lost. This results in the elevated PowerShell instance using the machine's default execution policy which, by default, is Restricted. This results in the following error that is silently swallowed.

File Home\kvm.ps1 cannot be loaded because running scripts is disabled on this
system.

bricelam avatar May 19 '14 17:05 bricelam

@bricelam I saw the same thing and noted it in issue #23, though that issue was more related to documentation. I agree this needs to be fixed, or at least clarified in the setup steps.

I was able to get around the above error as follows:

  1. Run Powershell as Administrator
  2. Run command set-executionpolicy RemoteSigned
  3. Close Powershell
  4. Follow procedures listed in the readme to run kvmsetup

After that was done I ran steps 1-3 again, with the command set-executionpolicy Restricted to restore the value back as it was previously set on my system.

Hope that helps others get around this problem, at least until it is fixed in the kvmsetup script itself.

clintkolodziej avatar May 21 '14 15:05 clintkolodziej

@clintkolodziej would be nice to just add in the Docs that you Must run as Elevated User when install kvm.

Doing so without will cause things to fail, had a weird issue cause it looked like it succeeded. But it did not when trying to run the samples. Running as admin fixed the issue.

mxrss avatar May 27 '14 23:05 mxrss

Our default installation instruction for kvm in home repo now passes in an unrestricted execution policy. So this issue should be gone now.

@powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/aspnet/Home/master/kvminstall.ps1'))"

Praburaj avatar Jan 08 '15 05:01 Praburaj