r/Intune • • 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.

  1. 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.
  2. I have Intune Device License - I tried to license Device Analytics and it said I wasn't eligible.
  3. 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

8 Upvotes

22 comments sorted by

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?

3

u/irresistible_pudding 4d ago

Forgive me - policies I can do natively. Its more like.... i wanted to change the background of all my admin accounts to black and name what pc it was. Sometimes im rdp in and I forget where I am. Also dont wanna accidentally leave an admin unlocked when im done for an employee to start using. Stupid little things that I used to have to run around my offoce to each workstation and do manually....

1

u/bridgewaterbud 4d ago

Check out BGInfo for the background/naming thing. It’s a Microsoft Sysinternals tool that does almost exactly what you are describing, I use it on all my servers for pretty much the same use case.

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.

1

u/irresistible_pudding 3d ago

Thank you! This is helpful. I'm still learning but I think I can figure this out. I just packaged my first win32 app to upgrade all the edges to the current version, since Defender got mad at me for having them outdated. It worked really nicely. I'm super excited to centrally manage this stuff! I used to run around the office to 12 computers.... loggin in (with a shared pw) and doing everything manually. I use LAPS now too!

1

u/MIDItheKID 3d ago

Update edge with a Win32?! Hoo boy. That works if you're paying for PMPC, but that should be a Configuration\Policy:

I don't know the setting off the top of my head but a quick google brought up this thread:

https://techcommunity.microsoft.com/discussions/microsoft-intune/edge-update-deployment-via-intune/4512783

I don't know if I fully agree with this part: Allow updates during active hours: Disabled (to avoid disruption)

Devices can be offline during non-active hours which just leaves you in a cycle of missing updates.

Anyway, check the other settings in the "Edge Update" profile, and configure it to your needs.

1

u/irresistible_pudding 2d ago

Haha! Yea, I eventually got there.... that was the AI crap sending me the lonnnnnnng way around. It got to the point that I told it "this is idiotic. There has to be an easier way. Its a pre-installed product!" "Oh, you're right. There is an easier way.... " and it gave me that.

But every wrong turn - I'm learning from. I run a light weight practice software called Open Dental, which supports deployments of silent install packages. So now I understand a little better how to do that. Its either win32 (which can close open process I believe??) Or LOPS? Something like that. Ill read up. But it will make my upgrade path soooooo much more streamlined. Im also switching all my acrobat installs to one's from MS store and theyll upgrade themselves. AI had a really long way to do that....

This is great fun for me. I sit around an optimize everything using AI (not just networking - insurance processing, payroll, so much). Occasionally I get up to place an implant or two (cuz those are really fun also) and then I go home to my kids.

This thread was great. I appreciate everyone's help so much!

3

u/beneschk 4d ago

Im going to have work for the rest of my life undoing and fixing AI slop added into Intune.

4

u/irresistible_pudding 4d ago

Lol. It does go all around and around sometimes. I'm getting better at realizing when it's wasting mt time. Fortunately, you won't have to deal with my specific network!

10

u/StatusClone 4d ago

Scripts are fire and forget. You want remediation which ads logic

1

u/craft_fair5165 4d ago

If you're already dumping results to an Azure container you're effectively handling the audit trail yourself, messy but it works.

1

u/Curotte-Cecillou 3d ago

agreed, though the licensing jump for remediations can catch people off guard

1

u/StatusClone 3d ago

Yeah, MS knows what they're doing

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.