Applies to: VisualSVN Server 3.4 and later.
This article describes how to resolve "The term is not recognized" error when you try to run VisualSVN Server PowerShell cmdlets in Windows PowerShell.
Attempting to run a VisualSVN Server PowerShell cmdlet, you receive the following or similar error message in the console:
Get-SvnRepository : The term 'Get-SvnRepository' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1 + Get-SvnRepository + ~~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (Get-SvnRepository:String) , CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException
Along with the message shown above, the PowerShell execution policy is
set to Restricted. Use the
Get-ExecutionPolicy cmdlet to show the execution policy that is effective for the current PowerShell session.
VisualSVN Server comes with a digitally-signed PowerShell module that provides server and repository administration cmdlets. The module loads automatically by default, except for when loading third-party PowerShell modules is restricted by the PowerShell execution policy. PowerShell execution policy is a safety feature that can prevent third-party modules from loading in order to protect the computer from untrusted scripts. Read Microsoft Docs | About Execution Policies for more information.
When the effective execution policy is Restricted, PowerShell will not load the VisualSVN Server module and you will see errors when trying to run the servers' cmdlets.
There are two ways to resolve the problem – by using the dedicated VisualSVN Server PowerShell console to run the cmdlets or by changing the execution policy to RemoteSigned.
Using the dedicated VisualSVN Server PowerShell console
VisualSVN Server cmdlets can be executed anytime using a dedicated VisualSVN Server PowerShell console. The VisualSVN Server PowerShell console automatically runs with at least the RemoteSigned execution policy, thus preventing the error in the first place.
Click the PowerShell icon on the VisualSVN Server Manager toolbar or follow these steps to start the console:
- On the Windows taskbar, click Start.
- Type VisualSVN Server PowerShell.
- Click VisualSVN Server PowerShell.
You can now run cmdlets in the opened VisualSVN Server PowerShell.
Changing the PowerShell execution policy
You need to change the execution policy to RemoteSigned to make PowerShell load the digitally signed modules. Follow these steps to change the execution policy:
- Start Windows PowerShell (click Run as administrator).
- Run the following command: Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
- Choose [Y] Yes to confirm the execution policy change.
- Run the Import-Module VisualSVN -Force command.
The execution policy will be set to RemoteSigned allowing to load the VisualSVN Server module and hence resolving the problem. Read Microsoft Docs | About Execution Policies for more information.