Loading...

How to use Teams/SharePoint as a logs location for support and send logs from device

1 A+ A-


In this post I will show you how to use Teams/Sharepoint as a location to gather logs, send logs from devices using PowerShell.


Context

- You want to send logs from a device somewhere

- You want a location easily available

- You want to make it available only for a specific team

- You want to use PowerShell to send logs without any user action


The solution

The solution can be achived in few steps:

1. Create a new Team/Sharepoint

2. Give access to it

3. Create a SharePoint app

4. Give this app write access on the SharePoint

5. Use PowerShell to send logs

I will soon share a systray tool allowing user to directly create a ZIP containing file, event logs... and send it to the SharePoint in one click.


Other posts

See below some other post I did:

- Upload file to SharePoint wit PowerShell

- Collect whatever you want on device with Intune


In this first one, I show two methods, SharePoint app or Azure app.


Creating Team/Sharepoint

In this step we will create a new team that will be used to gather logs.

We will proceed as below:

1. Go to Join a team or create a team


2. Click on Create a team


3. Click on From zero


4. Click on Private


5. Type a name


6. Click on Create


7. Click on the dots


8. Click on Add a canal


9. Type a name like Windows then Add


10. Go to your team and click on the dots

11. Click on Open in SharePoint




Creating a SharePoint application

In this step we will create a SharePoint application that will allow your script to connect to the SharePoint and send logs.

We will proceed as below:

1. Go to the Sharepoint site (previous step):


1. In address bar add: /_layouts/15/AppRegNew.aspx

2. My link will be:

https://systanddeploy.sharepoint.com/sites/SD-Logs/_layouts/15/AppRegNew.aspx

3. In Client ID and Secret, click on Generate

4. In Title, type a name

5. In App domain: type localhost

6. In Redirect URI, type: https://localhost


7. Click on Create

8. In the address bar replace AppRegNew.aspx with appinv.aspx

9. My link will be:

https://systanddeploy.sharepoint.com/sites/SD-Logs/_layouts/15/appinv.aspx

10. Type client ID in Appd ID and click on Lookup


11. In Permission Request XML, add below part:

12. Click on Create


13. Click on Trust it



Uploading content with PowerShell

In this step we will use PowerShell to connect to our team/SharePoint and upload a file.

We will proceed as below:

1. Import or install pnp module as below:

2. Add site, clientID, secret and folder in variables as below:

3. Connect to SharePoint as below:

4. Upload a file as below:

5. Disconnect

Teams 7879904735487177492

Enregistrer un commentaire

1 commentaire

Iván a dit…
Ce commentaire a été supprimé par l'auteur.
Accueil item

Award

Learn KQL in one month

Sponsors

You want to support me ?

Mes articles en français

Books in French


Stats