Venky
Venky

Reputation: 93

VisualSVN Server PowerShell configuration

I am new to VisualSVN PowerShell. I am getting the following error when I open the PowerShell itself.

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

If I use any Visual SVN Server cmdlets I am getting an error saying it is not recognized as a cmdlet. Please help.

EDIT: ShortcutStartup.ps1 contains the following code.

$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 ""

Upvotes: 2

Views: 999

Answers (1)

bahrep
bahrep

Reputation: 30662

VisualSVN Server PowerShell module requires PowerShell 3.0 or newer. However, you run PowerShell 1.0 on your Windows Server 2008.

It's a bug that the PowerShell console does not show a warning about unsupported PowerShell version. It shows it for PowerShell 2.0, though. I'm going to file a bug and we will fix it.

You could upgrade PowerShell on this server computer by following the steps specified in MSDN | Installing Windows PowerShell on Windows Server 2008.

Thanks for the report.

Upvotes: 1

Related Questions