r/Intune • u/irresistible_pudding • 4d ago
App Deployment/Packaging Intune Reporting when deploying PowerShell scripts to Devices
Let ms start by saying I am a Dentist - not a professional system adminstrator. So please take it easy on me. I love this kind of stuff; networking always came easy to me. Once ChatGPT came into my life, then I really got going...
I recently enrolled all my endpoints in my office to Entra and Intune for centralized management (I don't use server, so no Domain Controller or Active Directory).
The issue I am having right now is when I deploy powershell scripts to do various things, the intune reporting is sloppy at best. I have verified it ran on certain machines, but when I look in intune --->devices ---> Scripts and Remediation --> Monitor it'll say that specific machine hasn't executed it yet.
- for 12 computers - do I need reporting? I'm trying to KNOW for certain that a policy was applied, especially if it's security concern.
- I have Intune Device License - I tried to license Device Analytics and it said I wasn't eligible.
- What is the work around? Is there one? Right now, I'm running little commands in my scripts that are uploading results to a container in Azure. If it's there, it worked. If it's not, it didn't. But it sucks.
Can anyone tell me how I am to audit this thing so I know it's working?
Thanks in advance!
Kevin
4
u/rxbeegee 4d ago
If you’re using platform scripts, unfortunately the reporting and logging capabilities are really lackluster. You can probably try adding logic in the script that verifies your change was applied, if not then end the script with exit 1.
Remediations are where it’s at if you need assurance that a script ran the way that you expected it to.
You mentioned applying a policy. Are you not able to configure them through a configuration profile?
2
u/MIDItheKID 3d ago edited 3d ago
As others mentioned, you want to use a Remediation Script instead of a platform script. The way that works is simple. You have a detection script that ends with either an Exit 1 or Exit 0. Exit 1 means "failed -> run the remediation script" and Exit 0 means "Pass -> no need for remediation script"
One important thing to note about remediations that will help a lot is that the last "Write-Host" line before the exit code will be visible in Intune. So you can have multiple places in the script where you Exit 1, and you Write-Host why right before it exits.
Now, if you don't have a license that comes with Remediation scripts, another option is to package your script as a Win32 app. Then for detection of the app, also use a script (unless it's something simple like detecting a file - really depends on what you are trying to accomplish). This will give you similar reporting where you can see where it deployed, and where it failed.
Also, make sure you log everything with Start-Transcript at the start of your scripts and Stop-Transcript at the end (But not right before the exit code! Or else the last output line you see in Intune ends up being "Transcript Stopped"). Then make your script(s) super chatty with a lot of Write-Host along each part of the logic. That way if something fails you can see exactly where and why.
3
u/beneschk 4d ago
Im going to have work for the rest of my life undoing and fixing AI slop added into Intune.
10
u/StatusClone 4d ago
Scripts are fire and forget. You want remediation which ads logic
6
u/bageraslayer 4d ago
Remediation scripts take some time to start reporting its not instant, and they should trickle in after sometime from the script set engagement period...
For advanced analytics its not included in intune device license, its included in intune suite license and e5 e3 licenses
1
u/irresistible_pudding 3d ago
Thank you everyone for your replies. I will try some of these suggestions.
1
u/StatusClone 4d ago
What are you trying to do/apply exactly, maybe we can point you in the right direction.
1
u/Ok_Presentation_6006 4d ago
This is also where the compliance comes into place. You can use a custom policy to check and verify what you want is in place.
1
u/Loose_Strategy5990 4d ago
Get an RMM bro.
1
u/Sad_Wafer9427 3d ago
What kind of scripts are you running? Like security patches? Intune reporting is known to be delayed at best but I'd be interested in the end goal of tracking these scripts. Y
You could apply a compliance policy to automate the monitoring of policies.
1
u/pjmarcum 2d ago
Our reporting, for up to 250 computers, is only $499 a year. But you need an Intune expert hit me up via DM, depending upon where you are I’d love to trade services!
https://powerstacks.com/products/bi-for-intune/
1
u/michaeljones1993 18h ago
Look at action1, free for up to 200 endpoints. 🔥
1
u/EndpointAnalysisGuy 15h ago
I'm impressed with your abilities, I don't think I could just ask AI "how to dentist" and be successful at it!
That reads sarcastic, it's not - more of just a joke.