【问题标题】:VisualSVN Server PowerShell configurationVisualSVN 服务器 PowerShell 配置
【发布时间】:2016-09-16 06:05:09
【问题描述】:

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

一元运算符“-”后缺少表达式。
在行:1 字符:2
+ -E 

如果我使用任何 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 ""

【问题讨论】:

  • 路径“C:\Program Files ....”周围缺少引号
  • @DavidBrabant 我刚刚从“C:\Program Files (x86)\VisualSVN Server”目录打开了“VisualSVNServerShell.exe”。没有输入任何命令。打开exe后我立即收到这些错误。我不确定在哪里添加引号。
  • @TessellatingHeckler。我已将 'C:\Program Files (x86)\VisualSVN Server\ShortcutStartup.ps1' 中的代码添加到原始帖子中。谢谢。
  • 这看起来像是 VisualSVN 服务器中的一个错误。我建议您将其报告给support@visualsvn.com
  • 您的操作系统和 VisualSVN 服务器版本是什么?我刚刚在 Windows Server 2012 R2 上使用 VisualSVN Server 3.5.4 Standard 进行了测试,结果符合预期。

标签: powershell svn visualsvn-server visualsvn


【解决方案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。

感谢您的报告。

【讨论】:

  • 谢谢。我将安装 PowerShell 3.0 并更新状态。
  • 现在我没有收到我报告的错误。但是当运行“Get-Command -Module VisualSVN”时,没有显示 cmdlet。请帮助。我尝试在 PATH 变量中添加 Visual SVN 路径。仍然没有显示任何 cmdlet。
  • @behrep。我将执行策略设置为具有管理员权限的 RemoteSigned。还是没有运气。
  • @venky 运行 开始 |控制面板 | Programs and Features 并为 VisualSVN Server 选择 Repair 命令。似乎从 PowerShell 1.0 升级到 3.0 删除了必要的环境变量,这个修复应该会有所帮助。顺便说一句,您总是可以从 VisualSVN 服务器管理器运行 VisualSVN 服务器 PowerShell 控制台。
猜你喜欢
  • 1970-01-01
  • 2011-03-11
  • 2013-02-24
  • 2012-04-18
  • 2013-06-27
  • 2011-05-20
  • 2010-09-16
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多