VisualSVN 服务器 PowerShell 配置

VisualSVN Server PowerShell configuration

我是 VisualSVN PowerShell 的新手。打开 PowerShell 本身时出现以下错误。

Missing expression after unary operator '-'.
At line:1 char:2
+ -E <<<< xecutionPolicy Bypass -File C:\Program Files (x86)\VisualSVN Server\ShortcutStartup.ps1

如果我使用任何 Visual SVN Server cmdlet,我会收到一条错误消息,指出它未被识别为 cmdlet。请帮忙。

编辑: ShortcutStartup.ps1 包含以下代码。

$Host.UI.RawUI.WindowTitle = "VisualSVN Server PowerShell"

# Configure execution policy
Set-ExecutionPolicy -Scope Process Undefined -Force
if ($(Get-ExecutionPolicy) -eq "Restricted") {
  Set-ExecutionPolicy -Scope Process -ExecutionPolicy RemoteSigned -Force
}

$env:Path = (Join-Path (Split-Path $MyInvocation.MyCommand.Path -Parent) "bin") + ";" + $env:Path

# Check PowerShell version
$major = 0
if (Test-Path variable:global:PSVersionTable) {
  $major = $PSVersionTable.PSVersion.Major
}
if ($major -lt 3) {
  Write-Warning "VisualSVN Server PowerShell module requires Windows PowerShell 3.0 or later."
  exit
}

Write-Host ""
Write-Host "     Welcome to VisualSVN Server PowerShell!"
Write-Host ""
Write-Host " List of VisualSVN Server cmdlets: " -NoNewline
Write-Host "Get-Command -Module VisualSVN " -ForegroundColor Yellow
Write-Host " Get help for a cmdlet: " -NoNewline
Write-Host "help <cmdlet-name> " -NoNewline -ForegroundColor Yellow
Write-Host "or " -NoNewline
Write-Host "<cmdlet-name> -? " -ForegroundColor Yellow
Write-Host " Get online help for a cmdlet: " -NoNewline
Write-Host "help <cmdlet-name> -Online " -ForegroundColor Yellow
Write-Host ""

VisualSVN Server PowerShell module 需要 PowerShell 3.0 或更新版本。但是,您 运行 PowerShell 1.0 在 Windows Server 2008 上。

PowerShell 控制台不显示有关不受支持的 PowerShell 版本的警告,这是一个错误。不过,它针对 PowerShell 2.0 显示了它。我要提交错误,我们会修复它。

您可以按照 MSDN | Installing Windows PowerShell on Windows Server 2008 中指定的步骤在此服务器计算机上升级 PowerShell。

感谢报告。