Reputation: 55
I'm trying to send different types of files to myself over my local network using PowerShell. I think I'm onto something with the command;
Invoke-RestMethod -Uri http://192.168.0.164:8000/upload -Method Post -InFile "file.txt"`
But sadly, I get this response;
Invoke-RestMethod :
Error response
Error response
Error code: 400
Message: Field "files" not found.
Error code explanation: HTTPStatus.BAD_REQUEST - Bad request syntax or unsupported method.
The server I'm trying to upload to is just a python module called uploadserver; https://pypi.org/project/uploadserver/
How can I use PowerShell to upload files?
Upvotes: 0
Views: 694
Reputation: 45
If the server is on your local network you could mount the server as a network drive and simply run
Copy-item ./file.txt ./destinationdrive
Or you can use remoting So from your logged in session
$remote_session = New-PSsession
Copy-item ./file.txt -tosession $remote_session ./filepath/file.txt
Upvotes: 1