Automatic upload of Windows 10 logs to SharePoint


We have deployed a Ps script from Intune to collect some logfiles from a Windows 10 machine

Do we have any suggestions to get that log files uploaded to SharePoint automatically

Answers ( 3 )

  1. No response hence closing the thread!


    Thanks Anoop for your suggestion,Let me try this and circle back if in case of any issues

  2. Have you tried the following script from

    #Specify tenant admin and site URL
    $User = “[email protected]
    $SiteURL = “”
    $Folder = “C:\FilesToUpload”
    $DocLibName = “DocLib”

    #Add references to SharePoint client assemblies and authenticate to Office 365 site – required for CSOM
    Add-Type -Path “C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.dll”
    Add-Type -Path “C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.Runtime.dll”
    $Password = Read-Host -Prompt “Please enter your password” -AsSecureString

    #Bind to site collection
    $Context = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)
    $Creds = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($User,$Password)
    $Context.Credentials = $Creds

    #Retrieve list
    $List = $Context.Web.Lists.GetByTitle($DocLibName)

    #Upload file
    Foreach ($File in (dir $Folder))
    $FileStream = New-Object IO.FileStream($File.FullName,[System.IO.FileMode]::Open)
    $FileCreationInfo = New-Object Microsoft.SharePoint.Client.FileCreationInformation
    $FileCreationInfo.Overwrite = $true
    $FileCreationInfo.ContentStream = $FileStream
    $FileCreationInfo.URL = $File
    $Upload = $List.RootFolder.Files.Add($FileCreationInfo)

    Best answer

Leave an answer

Sorry, you do not have permission to answer to this question .