This reference provides descriptions and examples for all VisualSVN Server PowerShell cmdlets. Cmdlets are listed in alphabetical order based on the verb at the beginning of the cmdlet.


Cmdlet Description
Add-SvnAccessRule Adds a new rule that controls access to Subversion repositories.
Add-SvnRepositoryHook Adds a new repository hook to Subversion repositories.
Convert-SvnRepository Converts a regular Subversion repository to a distributed VDFS format and vice versa.
Get-SvnAccessRule Retrieves a list of rules that control access to Subversion repositories.
Get-SvnRepository Retrieves a list of Subversion repositories.
Get-SvnRepositoryHook Retrieves a list of the repository hooks configured in VisualSVN Server.
Get-SvnRepositoryItem Retrieves a list of files and folders for the specified path in a Subversion repository.
Get-SvnRepositoryReplication Gets the replication settings for a master VDFS repository.
Get-SvnServerConfiguration Returns the configuration settings of a VisualSVN Server instance.
Import-SvnRepository Imports a repository or a repository dump from the specified path.
Measure-SvnRepository Measures the disk space occupied by Subversion repositories.
New-SvnRepository Creates a Subversion repository.
New-SvnRepositoryItem Creates a folder in a Subversion repository.
Remove-SvnAccessRule Deletes one or more rules that control access to Subversion repositories.
Remove-SvnRepository Deletes a Subversion repository.
Remove-SvnRepositoryHook Deletes one or more repository hooks.
Remove-SvnRepositoryItem Deletes a file or a folder in a Subversion repository.
Rename-SvnRepository Renames a Subversion repository.
Resume-SvnRepository Resumes a suspended (read-only) VDFS repository.
Select-SvnAccessRule Returns an effective list of access rules for the specified path in a Subversion repository.
Set-SvnAccessRule Modifies an existing access rule that controls access to Subversion repositories.
Set-SvnRepository Modifies settings for a Subversion repository.
Set-SvnRepositoryHook Modifies the content of existing repository hooks.
Set-SvnRepositoryReplication Modifies replication settings for a master VDFS repository.
Set-SvnServerConfiguration Modifies the VisualSVN Server configuration settings.
Suspend-SvnRepository Makes a VDFS repository read-only temporarily.
Switch-SvnRepository Switches replication role for a VDFS repository.
Sync-SvnRepository Forces a slave VDFS repository to replicate data from the master repository.
Test-SvnRepository Verifies the integrity of data stored in a Subversion repository.

Add-SvnAccessRule

Available since VisualSVN Server 3.4.

Adds a new access rule to Subversion repositories. Access rules can be configured globally for all repositories or for a specific path in a particular repository.

Note
NoteAdd-SvnAccessRule and other cmdlets that work with access rules are currently available only if VisualSVN Server is configured to use Windows Authentication. See KB39: Understanding VisualSVN Server Authentication options for further details.

Example 1: add a global read/write access rule for a Devs user group

PS C:\> Add-SvnAccessRule -Global -AccountName contoso\Devs -Access ReadWrite

Example 2: add a read-only access for the trunk folder in the MyRepo repository

PS C:\> Add-SvnAccessRule MyRepo -Path /trunk -AccountName contoso\Devs -Access ReadOnly

Example 3: add a global read-only access for the BUILTIN\Users account using its SID string

PS C:\> Add-SvnAccessRule -Global -AccountId S-1-5-32-545 -Access ReadOnly

Add-SvnRepositoryHook

Available since VisualSVN Server 3.5.

Adds a new repository hook to Subversion repositories.

Example 1: add a new pre-revprop-change hook for the MyRepo repository with the "exit 1" content

PS C:\> Add-SvnRepositoryHook MyRepo -Type PreRevpropChange -Content "exit 1"

Example 2: add a new pre-revprop-change hook with the “exit 1” content for all slave VDFS repositories

PS C:\> Get-SvnRepository -Type VdfsSlave | Add-SvnRepositoryHook -Type PreRevpropChange -Content "exit 1"

Example 3: copy all existing repository hooks from the MyRepo repository to a NewRepo repository

PS C:\> Get-SvnRepositoryHook MyRepo | foreach {Add-SvnRepositoryHook NewRepo -Type $_.Type -Content $_.Content}

Convert-SvnRepository

Available since VisualSVN Server 3.4.

Converts a regular Subversion repository to a distributed VDFS format and vice versa. Conversion is performed in-place and requires all VisualSVN Server services to be stopped before the operation.

Note that a regular Subversion repository can be converted only to a master VDFS repository. Convert-SvnRepository cmdlet is not supported for slave VDFS repositories.

Example 1: convert the MyRepo FSFS repository to a master VDFS repository

PS C:\> Convert-SvnRepository MyRepo -TargetType VdfsMaster

Get-SvnAccessRule

Available since VisualSVN Server 3.4.

Retrieves a list of the access rules configured in VisualSVN Server. Retrieved access rules can be filtered by repository, repository path, account name (or SID) and access level. These filters may be applied separately or together in any combination.

Note
NoteGet-SvnAccessRule and other cmdlets that work with access rules are currently available only if VisualSVN Server is configured to use Windows Authentication. See KB39: Understanding VisualSVN Server Authentication options for further details.

Example 1: retrieve the full list of access rules configured for a VisualSVN Server instance

PS C:\> Get-SvnAccessRule

Example 2: retrieve a list of global access rules

PS C:\> Get-SvnAccessRule -Global

Example 3: retrieve a list of access rules filtered for the MyRepo repository

PS C:\> Get-SvnAccessRule MyRepo

Example 4: retrieve a list of access rules for all the trunk paths (in all repositories)

PS C:\> Get-SvnAccessRule -Path */trunk

Example 5: retrieve a list of access rules filtered for the Devs user group

PS C:\> Get-SvnAccessRule -AccountName contoso\Devs

Example 6: retrieve a list of access rules filtered for the BUILTIN\Users account using its SID string

PS C:\> Get-SvnAccessRule -AccountId S-1-5-32-545

Example 7: retrieve a list of all read/write access rules

PS C:\> Get-SvnAccessRule -Access ReadWrite

Example 8: retrieve a list of all access rules and export it to a CSV file

PS C:\> Get-SvnAccessRule | Select Repository, Path, AccountName, Access | Export-Csv -NoTypeInformation AccessReport.csv

Get-SvnRepository

Available since VisualSVN Server 3.4.

Retrieves a list of Subversion repositories. Retrieved repositories can be filtered by name and type. The Get-SvnRepository cmdlet can also be used to obtain such technical details of a repository as its UUID, internal data format, information about FSFS shards, etc.

Example 1: retrieve the full list of repositories hosted in a VisualSVN Server instance

PS C:\> Get-SvnRepository

Example 2: retrieve a list of slave VDFS repositories

PS C:\> Get-SvnRepository -Type VdfsSlave

Example 3: retrieve all repositories whose names start with ‘My’

PS C:\> Get-SvnRepository My*

Example 4: display technical details for the MyRepo repository

PS C:\> Get-SvnRepository MyRepo | Format-List

Get-SvnRepositoryHook

Available since VisualSVN Server 3.5.

Retrieves a list of the repository hooks configured in VisualSVN Server. Retrieved repository hooks can be filtered by repository, hook type and by the actual content of the hook. The content of the hooks can be filtered using the common wildcard characters. These filters may be applied separately or together in any combination.

Example 1: retrieve the full list of repository hooks configured for a VisualSVN Server instance

PS C:\> Get-SvnRepositoryHook

Example 2: retrieve a list of repository hooks filtered for the MyRepo repository

PS C:\> Get-SvnRepositoryHook MyRepo

Example 3: display the full content of the pre-revprop-change hook for the MyRepo repository

PS C:\> Get-SvnRepositoryHook MyRepo -Type PreRevpropChange | Format-List

Example 4: retrieve a list of all the post-commit hooks configured for a VisualSVN Server instance

PS C:\> Get-SvnRepositoryHook -Type PostCommit

Example 5: retrieve a list of all the pre-revprop-change hooks that contain the 'exit 0' substring

PS C:\> Get-SvnRepositoryHook -Type PreRevpropChange -Content '*exit 0*'

Get-SvnRepositoryItem

Available since VisualSVN Server 3.4.

Retrieves a list of files and folders for the specified path in a Subversion repository.

Example 1: retrieve a list of files and folders in the /trunk folder of the MyRepo repository

PS C:\> Get-SvnRepositoryItem MyRepo /trunk

Example 2: retrieve a list of all *.cpp files in the /trunk folder of the MyRepo repository

PS C:\> Get-SvnRepositoryItem MyRepo /trunk -Filter *.cpp

Example 3: retrieve a list of all folders in the /trunk folder of the MyRepo repository

PS C:\> Get-SvnRepositoryItem MyRepo /trunk -Type Folder

Get-SvnRepositoryReplication

Available since VisualSVN Server 3.4.

Gets the replication settings for a master VDFS repository. More specifically, this cmdlet returns the current replication status (enabled/disabled) and the list of authorized replicators.

Example 1: get the replication settings for the MyRepo repository

PS C:\> Get-SvnRepositoryReplication MyRepo

Get-SvnServerConfiguration

Available since VisualSVN Server 3.5.

Returns the configuration settings of a VisualSVN Server instance.

Example 1: get the current VisualSVN Server configuration settings

PS C:\> Get-SvnServerConfiguration

Example 2: backup the current VisualSVN Server settings to a 'config-backup.xml' file

PS C:\> Get-SvnServerConfiguration | Export-Clixml Get-SvnServerConfiguration | Export-Clixml config-backup.xml

Import-SvnRepository

Available since VisualSVN Server 3.4.

Imports a repository or a repository dump from the specified path. The name of the imported repository can be changed using the DestinationName parameter.

Example 1: import the Repo1 repository from a network share with the Repo2 destination name

PS C:\> Import-SvnRepository \\storage\Share\Repo1 -DestinationName Repo2

Example 2: import a repository from the MyRepo.dmp dump file taking the name of the dump file as the name for the new repository

PS C:\> Import-SvnRepository \\storage\Share\MyRepo.dmp

Measure-SvnRepository

Available since VisualSVN Server 3.4.

Measures the disk space occupied by Subversion repositories. This cmdlet can measure disk space for one or multiple repositories.

Example 1: measure the disk space for each repository hosted in a VisualSVN Server instance

PS C:\> Measure-SvnRepository

Example 2: measure the disk space occupied by the MyRepo repository

PS C:\> Measure-SvnRepository MyRepo

Example 3: measure the disk space for all repositories whose names start with ‘My’

PS C:\> Measure-SvnRepository My*

New-SvnRepository

Available since VisualSVN Server 3.4.

Creates a new Subversion repository. This cmdlet can be used to create both regular and distributed VDFS repositories.

Example 1: create a new FSFS repository named PlainRepo

PS C:\> New-SvnRepository PlainRepo

Example 2: create a new master VDFS repository named MyRepo

PS C:\> New-SvnRepository MyRepo -Type VdfsMaster

Example 3: create a new MyRepo slave VDFS repository and connect it to the co-named master repository on the berlin-svn server

PS C:\> New-SvnRepository MyRepo -Type VdfsSlave -MasterServer berlin-svn

Example 4: create a new MyRepo slave VDFS repository and connect it to the TheirRepo master repository on the berlin-svn server

PS C:\> New-SvnRepository MyRepo -Type VdfsSlave -MasterServer berlin-svn -MasterRepository TheirRepo

New-SvnRepositoryItem

Available since VisualSVN Server 3.4.

Creates a folder in a Subversion repository. This cmdlet can create multiple folders in a single transaction. Creating files is currently not supported.

Example 1: create a MyProject folder in the MyRepo repository with a custom log message

PS C:\> New-SvnRepositoryItem MyRepo -Path /MyProject -Type Folder -CommitMessage "Custom message."

Example 2: create branches, tags and trunk folders in the MyRepo repository

PS C:\> New-SvnRepositoryItem MyRepo -Path /branches, /tags, /trunk -Type Folder

Remove-SvnAccessRule

Available since VisualSVN Server 3.4.

Deletes one or more rules that control access to Subversion repositories.

Note
NoteRemove-SvnAccessRule and other cmdlets that work with access rules are currently available only if VisualSVN Server is configured to use Windows Authentication. See KB39: Understanding VisualSVN Server Authentication options for further details.

Example 1: delete access rule for the Devs user group from the trunk folder in the MyRepo repository

PS C:\> Remove-SvnAccessRule MyRepo -Path /trunk -AccountName contoso\Devs

Example 2: delete access rules for the Devs user group for all paths in the MyRepo repository

PS C:\> Remove-SvnAccessRule MyRepo -AccountName contoso\Devs

Example 3: delete global access rule for the Devs user group

PS C:\> Remove-SvnAccessRule -Global -AccountName contoso\Devs

Example 4: delete global access rule for the BUILTIN\Users account using its SID string

PS C:\> Remove-SvnAccessRule -Global -AccountId S-1-5-32-545

Remove-SvnRepository

Available since VisualSVN Server 3.4.

Deletes a Subversion repository.

Warning
Warning This operation is irreversible and should be performed with caution.

Example 1: delete the MyRepo repository

PS C:\> Remove-SvnRepository MyRepo

Remove-SvnRepositoryHook

Available since VisualSVN Server 3.5.

Deletes one or more repository hooks. Repository hooks to be deleted can be filtered by repository and hook type.

Example 1: delete post-commit repository hook for the MyRepo repository

PS C:\> Remove-SvnRepositoryHook MyRepo -Type PostCommit

Example 2: delete all the repository hooks configured for the MyRepo repository

PS C:\> Remove-SvnRepositoryHook MyRepo

Example 3: delete all the post-commit hooks configured for slave VDFS repositories

PS C:\> Get-SvnRepository -Type VdfsSlave | Get-SvnRepositoryHook -Type PostCommit | Remove-SvnRepositoryHook

Remove-SvnRepositoryItem

Available since VisualSVN Server 3.4.

Deletes a file or a folder in a Subversion repository. This cmdlet can delete multiple items in a single transaction.

Example 1: delete the readme.txt file in the root of the MyRepo repository with a custom log message

PS C:\> Remove-SvnRepositoryItem MyRepo -Path /readme.txt -CommitMessage "Custom message."

Example 2: delete the branches and tags folders from the MyRepo repository

PS C:\> Remove-SvnRepositoryItem MyRepo -Path /readme.txt -CommitMessage "Custom message."

Rename-SvnRepository

Available since VisualSVN Server 3.4.

Renames a Subversion repository.

Example 1: rename the MyRepo repository to NewRepo

PS C:\> Rename-SvnRepository MyRepo -NewName NewRepo

Resume-SvnRepository

Available since VisualSVN Server 3.4.

Resumes a suspended (read-only) VDFS repository. A VDFS repository can be suspended for maintenance or disaster recovery reasons. Suspended VDFS repositories do not accept commits and other repository data modifications. Suspended slave VDFS repositories do not replicate changes from master repositories.

Example 1: resume a suspended MyRepo repository

PS C:\> Resume-SvnRepository MyRepo

Select-SvnAccessRule

Available since VisualSVN Server 3.4.

Returns an effective list of access rules for the specified path in a Subversion repository. This list of access rules corresponds to the content of the Security tab in VisualSVN Server Manager.

The result of Select-SvnAccessRule cmdlet differs from the results of Get-SvnAccessRule cmdlet executed for a particular path in repository in the following ways:

  • the result of Select-SvnAccessRule includes access rules from all the parent paths,
  • in the same time, overridden access rules are filtered out from the results of Select-SvnAccessRule.

For information about access rules in Subversion, please read the KB33: Understanding VisualSVN Server authorization article.

Note
NoteSelect-SvnAccessRule and other cmdlets that work with access rules are currently available only if VisualSVN Server is configured to use Windows Authentication. See KB39: Understanding VisualSVN Server Authentication options for further details.

Example 1: display an effective list of access rules for the trunk folder in the MyRepo repository

PS C:\> Select-SvnAccessRule MyRepo -Path /trunk

Set-SvnAccessRule

Available since VisualSVN Server 3.4.

Modifies an existing access rule that controls access to Subversion repositories.

Note
NoteSet-SvnAccessRule and other cmdlets that work with access rules are currently available only if VisualSVN Server is configured to use Windows Authentication. See KB39: Understanding VisualSVN Server Authentication options for further details.

Example 1: change access level to ReadOnly for the Devs user group for the tags folder in the MyRepo repository

PS C:\> Set-SvnAccessRule MyRepo -Path /trunk -AccountName contoso\Devs -Access ReadOnly

Example 2: change global access level to NoAccess for the Jack user

PS C:\> Set-SvnAccessRule -Global -AccountName contoso\Jack -Access NoAccess

Example 3: change level of all access rule configured for the Jack user to NoAccess

PS C:\> Get-SvnAccessRule -AccountName contoso\Jack | Set-SvnAccessRule -Access NoAccess

Set-SvnRepository

Available since VisualSVN Server 3.4.

Modifies settings for a Subversion repository. This cmdlet currently supports modifications to settings related only to slave VDFS repositories.

Example 1: change the name of the master VDFS repository to NewMaster for the MyRepo slave VDFS repository

PS C:\> Set-SvnRepository MyRepo -MasterRepository NewMaster

Example 2: change the name of master server to berlin-svn-new for the MyRepo slave VDFS repository

PS C:\> Set-SvnRepository MyRepo -MasterServer berlin-svn-new

Set-SvnRepositoryHook

Available since VisualSVN Server 3.5.

Modifies the content of existing repository hooks.

Example 1: set the content of the pre-revprop-change hook for the MyRepo repository to 'exit 0'

PS C:\> Set-SvnRepositoryHook MyRepo -Type PreRevpropChange -Content 'exit 0'

Example 2: set the content of all existing pre-revprop-change hooks for slave VDFS repositories to 'exit 1'

PS C:\> Get-SvnRepository -Type VdfsSlave | Get-SvnRepositoryHook -Type PreRevpropChange | Set-SvnRepositoryHook -Content 'exit 1'

Example 3: set the content of the post-commit hook for the MyRepo repository to the multiline text (just press Enter after each line)

PS C:\> Set-SvnRepositoryHook MyRepo -Type PostCommit -Content 'rem first line
>> rem second line
>> exit 0
>> '

Set-SvnRepositoryReplication

Available since VisualSVN Server 3.4.

Modifies replication settings for a master VDFS repository.

Example 1: disable replication of the MyRepo master VDFS repository

PS C:\> Set-SvnRepositoryReplication MyRepo -Enabled $false

Example 2: specify list of servers allowed to replicate data from the MyRepo repository

PS C:\> Set-SvnRepositoryReplication MyRepo -Replicators contoso\ny-svn$, contoso\rome-svn$
Note
Note The ‘$’ symbol is added to the ny-svn and rome-svn server names in order to specify access for the computer accounts, because the VDFS service runs under the NetworkService account that acts as the computer on the network. For further details please consider the Active Directory naming article on the MSDN.

Set-SvnServerConfiguration

Available since VisualSVN Server 3.5.

Modifies the VisualSVN Server configuration settings.

The following settings can be modified:

  • ServerName: fully qualified domain name of the server ('svn.contoso.com' for example). To return to default fully qualified name for your server set the ServerName to an empty string.
  • RepositoriesRoot: the path where repositories are stored on the disk ('C:\Repositories\' is the default).
  • RepositoriesURLPrefix: an URL prefix that is used to access the repositories (a MyRepo repository will be available at https://svn.contoso.com/svn/MyRepo URL if RepositoriesURLPrefix is set to '/svn').
  • ListenPort: the port the server is listening to (443 is the default).
  • ListeningIPAddress: the list of IP addresses that the server binds to (for usage patterns see the examples below).
  • EnableSSL: enables HTTPS also known as HTTP over SSL ($True by default).
  • AuthenticationMode: supported authentication modes are Subversion and Windows.
  • EnableBasicAuthentication: enables Basic Windows Authentication method.
  • EnableIntegratedAuthentication: enables Integrated Windows Authentication (which is available in VisualSVN Server Enterprise Edition only).
  • RedirectFromLegacyWebInterface: enables automatic redirection from legacy pre-3.2.0 web interface ($True by default).
  • EnableOperationalLogging: enables Operational Logging (which is available in VisualSVN Server Enterprise Edition only).
  • EnableAccessLogging: enables Access Logging (which is available in VisualSVN Server Enterprise Edition only).

Example 1: change the server port to '8443'

PS C:\> Set-SvnServerConfiguration -ListenPort 8443

Example 2: restore the VisualSVN Server settings from a 'config-backup.xml' file

PS C:\> Import-Clixml config-backup.xml | Set-SvnServerConfiguration

Example 3: bind server to all available IP addresses

PS C:\> Set-SvnServerConfiguration -ListeningIPAddress All

Example 4: bind server to the '127.0.0.1' and '::1' IP addresses

PS C:\> Set-SvnServerConfiguration -ListeningIPAddress "127.0.0.1", "::1"

Example 5: switch server to Windows authentication mode with both Basic and Integrated authentication method enabled

PS C:\> Set-SvnServerConfiguration -AuthenticationMode Windows -EnableBasicAuthentication $True -EnableIntegratedAuthentication $True

Suspend-SvnRepository

Available since VisualSVN Server 3.4.

Makes a VDFS repository read-only temporarily. A VDFS repository can be suspended for maintenance or disaster recovery reasons. Suspended VDFS repositories do not accept commits and other repository data modifications. Suspended slave VDFS repositories do not replicate changes from master repositories.

Example 1: suspend the MyRepo VDFS repository

PS C:\> Suspend-SvnRepository MyRepo

Example 2: suspend all the master VDFS repositories on the current server

PS C:\> Get-SvnRepository -Type VdfsMaster | Suspend-SvnRepository

Switch-SvnRepository

Available since VisualSVN Server 3.4.

Switches replication role for a VDFS repository.

Note
Note This operation is mostly required for disaster recovery needs and should be used with caution. VDFS repositories can become out of sync if this cmdlet is used improperly. Check the KB93: Performing disaster recovery for distributed VDFS repositories article for further details.

Example 1: switch replication role of the MyRepo repository to ‘master’

PS C:\> Switch-SvnRepository MyRepo -Role Master

Example 2: switch replication role of the MyRepo repository to ‘slave’ providing connection details to the TheirRepo master repository on the berlin-svn server

PS C:\> Switch-SvnRepository MyRepo -Role Slave -MasterServer berlin-svn -MasterRepository TheirRepo

Sync-SvnRepository

Available since VisualSVN Server 3.4.

Forces a slave VDFS repository to replicate data from the master repository.

This cmdlet is useful to detect VDFS configuration problems, because it displays error messages if the replication fails. Moreover, Sync-SvnRepository cmdlet is very important for disaster recovery needs, because it guarantees that the slave will be fully up-to-date in case the master repository is suspended.

Example 1: force the MyRepo slave VDFS repository to replicate data from the master repository

PS C:\> Sync-SvnRepository MyRepo -PassThru

Note that the -PassThru parameter is optional and can be used to display the youngest revision in the slave repository after synchronization.

Test-SvnRepository

Available since VisualSVN Server 3.4.

Verifies the integrity of data stored in a Subversion repository. This operation is currently equivalent to the svnadmin verify command. The alias (alternate name) for this cmdlet is Verify-SvnRepository.

Example 1: verify the MyRepo repository

PS C:\> Test-SvnRepository MyRepo
Last Modified: