You should look into using SharePoint Patterns and Practices (PnP):
Particularly these commands: Connect-PnPOnline and Add-PnPFile
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hi,
We have x number of azure ad registered clients around the world, that we use a 3part remote manaement tool for, we want to publish a script to these machines from this 3part, and that is ok. Today I use a script that download a file from a onedrive for business share using only the following code
$url = "https://xxxxx-my.sharepoint.com/:u:/g/personal/sdsdsdsdsd?download=1"
$output = "c:\HWID\script.ps1"
$start_time = Get-Date
Invoke-WebRequest -Uri $url -OutFile $output
Write-Output "Time taken: $((Get-Date).Subtract($start_time).Seconds) second(s)"
When I run this I am not prompted to insert any credentials.
What this script does it generate a file I want to upload to the same share. This share is a public share so its possible for everyone to upload, but I am not able to do it with powershell command, it seems I dont have the correct link, and not the right code because it asks for credentials. If I use a webbrowser it does not ask. What code should I use ?
If thats a big code, then how can I for example email that log file instead... ?
All must be done without user interaction.
Thanks for reply.
You should look into using SharePoint Patterns and Practices (PnP):
Particularly these commands: Connect-PnPOnline and Add-PnPFile