2

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 ""
6
  • missing quotes around the path "C:\Program Files ...." Commented Sep 16, 2016 at 6:18
  • @DavidBrabant I just opened 'VisualSVNServerShell.exe' from "C:\Program Files (x86)\VisualSVN Server" directory. Did not enter any commands. I got these errors immediately after opening the exe. I am not sure where to add the quotes. Commented Sep 16, 2016 at 6:37
  • @TessellatingHeckler. I have added the code from 'C:\Program Files (x86)\VisualSVN Server\ShortcutStartup.ps1' to the original post. Thanks. Commented Sep 16, 2016 at 6:40
  • 1
    It looks like a bug in VisualSVN Server. I suggest you to report it to [email protected] Commented Sep 16, 2016 at 7:47
  • What are your operating system and VisualSVN Server versions? I just tested with VisualSVN Server 3.5.4 Standard on Windows Server 2012 R2, and it worked as one would expect. Commented Sep 16, 2016 at 10:29

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

4 Comments

Thanks. I will install PowerShell 3.0 and update the status.
Now I am not getting the error I reported. But when run 'Get-Command -Module VisualSVN' no cmdlet is displayed. Please help.I tried adding the Visual SVN path in the PATH variable. Still no cmdletes are displayed.
@behrep. I set the Execution Policy as RemoteSigned with admin rights. Still no luck.
@venky Run Start | Control Panel | Programs and Features and select Repair command for VisualSVN Server. It seems that upgrade from PowerShell 1.0 to 3.0 erased necessary environment variables and this repair should help. BTW, you could always run VisualSVN Server PowerShell console from VisualSVN Server Manager.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.