Automatic upload of Windows 10 logs to SharePoint

Question

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 2 months 3 Answers 51 views Beginner 0

Answers ( 3 )

  1. Have you tried the following script from https://sharepoint.stackexchange.com/questions/120360/upload-log-file-to-sharepoint-online-dummy

    #Specify tenant admin and site URL
    $User = “[email protected]
    $SiteURL = “https://tenant.sharepoint.com/sites/site”
    $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)
    $Context.Load($List)
    $Context.ExecuteQuery()

    #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)
    $Context.Load($Upload)
    $Context.ExecuteQuery()
    }

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

  3. No response hence closing the thread!

Leave an answer

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