What?
Mounting Nexcloud directories as logical drives is not reliable. The HTTP-methods provided by cURL are reliable and perform sufficiently for the QRS data volumes. In order to use cURL in Windows, the scripts need to know the path to the exe file. The Invoke-Webrequest cmdlet performs the same without this requirement.
Download
For downloading a file, the path onto the cloud is required:
$URI = "https://ppp.woelkli.com/remote.php/dav/files/user[/subfolder]/file"
The Credentials for the DAV are passed to a PSCredential-Objec using the -ArugmentList parameter of its constructor.
$PSC = New-Object System.Management.Automation.PSCredential -ArgumentList($Usr, $PwS)
To avoid unnecessary analysis of the downloaded content the -UseBasicParsing is included in the call.
downloadin a file into a destination folder $Dst is intuitive:
Invoke-Webrequest -UseBasicParsing -Uri $URI -Credential $PSC -OutFile $Dst
Upload
An Upload requires specifying the method to the web server. The method is PUT and is specified as the value for the -Method parameter. The path to the local file is specified in the -InFile Parameter:
$WRS = Invoke-Webrequest -UseBasicParsing -URI $URI -Method PUT -Credential-PSC -InFile $Src
The Cmdlet returns a WebResponse object which contains two useful properties containing transfer status information:
$WRS.StatusCode values of a successful transfer are 201 (Created) and 204 (no content)
$WRS.StatusDescription contains a corresponding description message
Comments :