2016-09-16 62 views
2

我是Visual SVN PowerShell的新手。當我打開PowerShell本身時出現以下錯誤。Visual SVN Server 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服務器的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 "" 
+0

缺少路徑「C:\ Program Files文件....」的引號 –

+0

@DavidBrabant我剛從「C:\ Program Files(x86)\ VisualSVN Server」目錄打開'VisualSVNServerShell.exe'。沒有輸入任何命令。打開exe後,我立即得到這些錯誤。我不確定在哪裏添加引號。 – Venky

+0

@TessellatingHeckler。我已將「C:\ Program Files(x86)\ VisualSVN Server \ ShortcutStartup.ps1」中的代碼添加到原始帖子中。謝謝。 – Venky

回答

1

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

這是一個錯誤,PowerShell控制檯不顯示關於不支持的PowerShell版本的警告。不過,它爲PowerShell 2.0展示了它。我要提交一個錯誤,我們會解決它。

您可以按照MSDN | Installing Windows PowerShell on Windows Server 2008中指定的步驟升級該服務器計算機上的PowerShell。

感謝您的報告。

+0

謝謝。我將安裝PowerShell 3.0並更新狀態。 – Venky

+0

現在我沒有收到我報告的錯誤。但是當運行'Get-Command -Module VisualSVN'時,不顯示任何cmdlet。請help.I嘗試在PATH變量中添加Visual SVN路徑。仍然不顯示cmdletes。 – Venky

+0

@behrep。我將執行策略設置爲帶管理員權限的RemoteSigned。仍然沒有運氣。 – Venky