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

solved 0
Suresh Gopi Kolluri 4 months 3 Answers 67 views Beginner 0

Answers ( 3 )

  1. No response hence closing the thread!

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

  3. 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 FilesCommon FilesMicrosoft SharedWeb Server Extensions15ISAPIMicrosoft.SharePoint.Client.dll”
    Add-Type -Path “C:Program FilesCommon FilesMicrosoft SharedWeb Server Extensions15ISAPIMicrosoft.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 a permission to answer to this question .