Using PowerShell and Graph to get BSOD results (code and date ) for Intune devices
In this post we will see how to use PowerShell and Graph to get BSOD results (date and error code) for a specific device.
Context
- You have enrolled devices
- You want to check if a device has some BSOD recently
- You want to display date and error code
The solution
In Endpoint Analytics you can get some awesome information like startup performance and BSOD.
For this we will proceed as below:
1. Go to Endpoint Analytics > Startup performance
2. Select Device performance tab
3. Type a device name in the search bar
4. Click on the result
5. Select Startup performance
6. You will have some info like:
- Insights and recommendations
- Boot history
- Sign-in history
- Top 10 impacting startup processes
- OS restart history
7. We will use there part: OS restart history
8. It list all restart including BSOD
Graph resource
Now let's see how to do the same with Graph.
For this we will use the developer mode of our brower to check appropriate resource.
You can see how to proceed in my post there.
Using this method, the appropriate Graph resource is:
deviceManagement/userExperienceAnalyticsDeviceStartupHistory
Do it with PowerShell
Now let's do it with PowerShell.
I created two scripts using one of both modules:
- Microsoft.Graph.Intune
- MSAL.PS
You can get the script by clicking on the below picture:
It will work as below:
1. Open PowerShell prompt
2. Use the appropriate PS1 script (depending of the module you want to use)
3. Type script name: GetDevice_BSOD.ps1
4. Then add devicename as parameter, as below:
5. See below the result:
6. Use ShowGrid to display result in gridview, as below:
7. See below the result:
Enregistrer un commentaire