2016-09-16 38 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