Forum Discussion

Nick_2022's avatar
Nick_2022
Copper Contributor
Jun 07, 2022
Solved

Sending PowerShell script output to a remote SharePoint folder

Hi all, 

 

I am currently working on a PowerShell script which has its own logging function. 

I'm currently logging into a local file on my desktop, but I want to the logs to be directly send to a remote SharePoint folder. So far I couldn't find a good solution without storing the "logs" locally and then upload them to a SharePoint. 

 

I'm trying to this with the out-file command from PowerShell.

 

 

Has anyone a clue how to solve this or is there basically no way to do this.

 

 

Best regards

  • Nick_2022 are we talking about SharePoint Online (Cloud) or SharePoint On-Premise version ?

     

    For SharePoint Online you can use the following link as starting point https://www.sharepointdiary.com/2016/06/upload-files-to-sharepoint-online-using-powershell.html

    For SharePoint On-Premise you can use the following link as starting point https://www.sharepointdiary.com/2015/07/upload-files-to-sharepoint-remotely-using-powershell-csom.html

     

    Concerning SharePoint Online things are more "complicated" depending on your M365 Tenant configuration. If you have MFA enabled in your tenant (most probably) then I suggest you to use a ClientId approach (https://www.sharepointdiary.com/2019/08/connect-sharepoint-online-powershell-using-mfa.html a sample)

2 Replies

  • mr_w1nst0n's avatar
    mr_w1nst0n
    Iron Contributor

    Nick_2022 are we talking about SharePoint Online (Cloud) or SharePoint On-Premise version ?

     

    For SharePoint Online you can use the following link as starting point https://www.sharepointdiary.com/2016/06/upload-files-to-sharepoint-online-using-powershell.html

    For SharePoint On-Premise you can use the following link as starting point https://www.sharepointdiary.com/2015/07/upload-files-to-sharepoint-remotely-using-powershell-csom.html

     

    Concerning SharePoint Online things are more "complicated" depending on your M365 Tenant configuration. If you have MFA enabled in your tenant (most probably) then I suggest you to use a ClientId approach (https://www.sharepointdiary.com/2019/08/connect-sharepoint-online-powershell-using-mfa.html a sample)

Resources