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
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
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 )
No response hence closing the thread!
Thanks Anoop for your suggestion,Let me try this and circle back if in case of any issues
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 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)
$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()
}