Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)


Topic review


Re: Powershell WebDav protocol error message 405 Method Not Allowed"

Your WebDAV server probably does not run on HTTP root, but in some subfolder only, like /webdav.

So you need to add RootPath = "/webdav" to your $sessionOptions.


Powershell WebDav protocol error message 405 Method Not Allowed"

I need to make a powershell script to put files with Webdev. I generated the code from the GUI (file transfer worked ok with GUI) and added some code. Get error message: 405 Method Not Allowed"
This is the script:
# Parameters
$FILE = "getalladusers.csv"
$LOCALPATH = "\\data\Afdeling\filename"
$REMOTEPATH = "/webdav/import"
Write-Host "FILE       = $FILE "
Write-Host " "
# Load WinSCP .NET assembly
Add-Type -Path 'C:\Program Files (x86)\WinSCP\WinSCPnet.dll'
# Set up session options
$sessionOptions = New-Object WinSCP.SessionOptions -Property @{
    Protocol = [WinSCP.Protocol]::Webdav
    HostName = ""
    PortNumber = 443
    UserName = "WebDav"
    Password = "32pyd-y22cq-v4ddq"
    WebdavSecure = $True
$session = New-Object WinSCP.Session
    # Connect
    # Start Your code
    $transferResult = $session.PutFiles("$LOCALPATH\$FILE", "$REMOTEPATH", $False, $transferOptions)
    # Throw on any error
    # Print results
    foreach ($transfer in $transferResult.Transfers)
        Write-Host ("Upload of {0} succeeded" -f $transfer.FileName)