无法加载kvm.ps1,因为在此系统上禁用运行脚本

时间:2014-05-22 15:58:56

标签: asp.net-core

我正在尝试运行Asp.net vNext示例应用程序。

但是当我尝试执行命令时

kvm list

它给我错误信息

kvm.ps1 cannot be loaded because running scripts is disable on this system

我也试图改为执行政策。但我仍然得到同样的错误。

2 个答案:

答案 0 :(得分:1)

试试这个

在控制台上执行此命令

**"powershell Set-ExecutionPolicy RemoteSigned"**, 

之后运行命令

$tempPath = Join-Path $env:TEMP "kvminstall"
$kvmPs1Path = Join-Path $tempPath "kvm.ps1"
$kvmCmdPath = Join-Path $tempPath "kvm.cmd"

Write-Host "Using temporary directory: $tempPath"
if (!(Test-Path $tempPath)) { md $tempPath | Out-Null }


$webClient = New-Object System.Net.WebClient
Write-Host "Downloading KVM.ps1 to $kvmPs1Path"
$webClient.DownloadFile('https://raw.githubusercontent.com/aspnet/Home/master/kvm.ps1', $kvmPs1Path)
Write-Host "Downloading KVM.cmd to $kvmCmdPath"
$webClient.DownloadFile('https://raw.githubusercontent.com/aspnet/Home/master/kvm.cmd', $kvmCmdPath)
Write-Host "Installing KVM"
& $kvmCmdPath setup

答案 1 :(得分:0)

您可以尝试使用powershell命令Unblock-File