PowerShell SharpSvn Certificate issue?

I'm trying to do an svn checkout or update from SVN using PowerShell 2.0 and SharpSVN 1.7?

When I run TortoiseSVN outside of Powershell - I get a certificate error, and have to accept with a click and then I am connected. In PowerShell using SharpSvn, I get the following error:

Exception calling "CheckOut" with "2" argument(s): "Unable to connect to a repository at URL '...'"
At Z:\Temp\SVNTEST\svntest.ps1:64 char:20
+ $svnClient.CheckOut <<<< ($repoUri, $svnLocalPath)
+ CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodException

The code is pretty staightforward, there ar some C# examples of adding an exception handler which traps an error and succeeds, I'm not sure if this is my issue or how to do this in PowerShell

Here's the code snippet - any help appreciated

[System.IO.Directory]::SetCurrentDirectory($currentScriptDirectory.Path)

$evidence = [System.Reflection.Assembly]::GetExecutingAssembly().Evidence

[Reflection.Assembly]::LoadFile(("...SharpSvn.dll"),$evidence)

$svnClient = new-object SharpSvn.SvnClient 

$repoUri = new-object SharpSvn.SvnUriTarget($svnUrl) 

$svnClient.Authentication.DefaultCredentials = New-Object System.Net.NetworkCredential($svnUsername,$svnPassword)

$svnClient.CheckOut($repoUri, $svnLocalPath) 

Answers


$svnClient.Authentication.add_SslServerTrustHandlers({
        $_.AcceptedFailures = $_.Failures
        $_.Save = $True
    })

Need Your Help

Using SimpleXmlElement and symfony2 to output xml file

xml symfony

$rootNode = new \SimpleXMLElement( "&lt;?xml version='1.0' encoding='UTF-8' standalone='yes'?&gt;&lt;items&gt;&lt;/items&gt;" );