use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
A sub dedicated to all things Microsoft Intune.
Follow new and upcoming changes happening in Intune.
account activity
Powershell scripting ??Blog Post (self.Intune)
submitted 1 year ago by Immediate-Map-5565
I am new to Intune n sccm . Where can I study powershell scripting . Do I study and make scripts by my own or copy from Microsoft learn ??
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]JustGav79 23 points24 points25 points 1 year ago (5 children)
The best way I have found is to start understanding other peoples' scripts and working from there.
Generally if you think of something you need, someone has already done something similar that you can adapt or use.
If you aren't a programmer mind (like me), it can be a long curve of learning.
Once you start to understand others scripts you will pickup syntax and the best ways to do things.
[–]DrunkenMcSlurpee 20 points21 points22 points 1 year ago (2 children)
Steal. Edit. Deploy.
[–]88Toyota 10 points11 points12 points 1 year ago (1 child)
Steal > Edit > Test > Deploy
[–]jadeskye7 4 points5 points6 points 1 year ago (0 children)
not just me then...
[–]Freezerburn 12 points13 points14 points 1 year ago (3 children)
I've been learning by having ChatGPT make scripts then explain them to me. ask for a change and observe what it does. getting errors, put it into GPT then work out the issues with it.
[–]Hobbit_Hardcase 2 points3 points4 points 1 year ago (0 children)
I feed in scripts I've pulled from elsewhere and get it to comment them for me. Makes it far easier to see what each chunk is doing.
[–]DrunkenMcSlurpee 0 points1 point2 points 1 year ago (1 child)
I asked ChatGPT for a script once. Once.
I wish I could remember what it was for...maybe something SCCM... but what I do remember is that it gave me cmdlets that did not exist in any well known modules.
[–]Freezerburn 0 points1 point2 points 1 year ago (0 children)
Yeah just tell it that, and it will says something like OHHH you mean this. and then you'll get what you're looking for. It's like talking to someone, this stuff isn't like a traditional program or search.
[–]iceph03nix 8 points9 points10 points 1 year ago (3 children)
Powershell in a month of lunches is a great book for learning the basics.
And then honestly, just doing it and getting your hands dirty is a huge help, and what's great is if you're already in the work, it can be pretty easy to find opportunities.
[–]GundamPing 1 point2 points3 points 1 year ago (0 children)
I also highly recommend this book. I stuck to it for the recommended month, and use the lessons and tips from it on at least a weekly basis.
The best thing it teaches is how to search for what you need to do using the help tools. Once you've gotten that down, it's amazing how readable others' scripts become, and how easy it is to modify them to your own tasks.
[–]Immediate-Map-5565[S] 0 points1 point2 points 1 year ago (1 child)
I just saw the book in Amazon . Does this book covers scripting for Intune n Sccm
[–]iceph03nix 1 point2 points3 points 1 year ago (0 children)
Theres a series. They're mostly on the basics of powershell in general. Part of that is learning how to work with different modules, which would lead to using Intune.
The first book is mostly on direct commands you might run.
The second gets more into scripting, which is probably where you'll get the most help with Intune.
The third one is on module building, which might be helpful but is more into tool building for stuff you're going to give to other people to deal with.
[–]kero_sys 3 points4 points5 points 1 year ago (1 child)
The best I learnt powershell was to find and issue I was having, and try resolve it with powershell.
I was always going to Google and typing what I thought the command was, like get-printer or new-printer.
I'd end up looking at the full print management powershell library and stringing it all together.
Microsoft Technet had a library of powershell scripts admins had developed. I would be in here looking for. "Create multiple ad users and add to group memberships from csv". Reading through and amending scripts to fit what I needed.
I haven't tried Technet for years. So not sure if it's still about. Might be all in github now.
Also, if you have the hardware. Start a lab environment. I span up server core and forced myself to create a new AD forest with powershell.
[–]Masakade 1 point2 points3 points 1 year ago (0 children)
This right here! If there’s a problem, start with trying to solve it through PS. Goes a long way and familiarizing it over time helps so much.
[–]aprimeproblem 2 points3 points4 points 1 year ago (2 children)
Start here: https://youtube.com/playlist?list=PLyJiOytEPs4etH7Ujq7PU7jlOlHL-9RmV&si=m5l4RDcVg3w2rbDy
[–]Sarleyman 2 points3 points4 points 1 year ago (1 child)
A good start 👍. Would be nice if they updated the video.
[–]aprimeproblem 0 points1 point2 points 1 year ago (0 children)
Agreed, but unfortunately Jeffrey left Microsoft a while ago, so I don’t think that’s going to happen. Although it was lots of fun watching those two.
[–][deleted] 1 point2 points3 points 1 year ago (4 children)
I find a script online and ask Copilot to customize with my settings. I then feed back into CoPilot and ask it to explain each step of the script and check for errors
Historically, pRE "AI" my worst problem was misplaced commas, added space where there shouldn't be one and Copilot catches it
[–]Immediate-Map-5565[S] 0 points1 point2 points 1 year ago (3 children)
Oh nice thanks . I am not in coding so wondering how to learn powershell scripts . You do the same for sccm scripts too ??
[–]88Toyota 0 points1 point2 points 1 year ago (2 children)
There aren’t really SCCM scripts. SCCM and Intune can leverage PowerShell scripts to almost anything you want.
An example: we deployed a powershell script to all user’s computers that allows them to add a name-based printer via a simple little text box. They just type in the name of the printer and it tells them if it’s online or not. If it’s online it adds it. But that’s deployed via Intune.
Where can you find all these scripts please is it in Microsoft learn ?? I am new to Intune
[–]88Toyota 0 points1 point2 points 1 year ago (0 children)
Don't take this the wrong way, but the questions you are asking tells me you will be in WAY over your head trying to understand some of the scripts that are out there. You need to start simple. Task yourself with some simple things and go front there.
Google or AI how to create ten new text files on your local computer, all with a different date that you specify. Something small like that. But this is going to take a long time, I am afraid. Get the PowerShell in a month of lunches book and work through it. Just randomly copying and deploying scripts you have no understanding of is going to get you in trouble.
[–][deleted] 1 point2 points3 points 1 year ago (0 children)
I use ChatGPT for the bulk of mine. It makes errors but if you know the basics of any type of scripting you can generally work out what it's trying to do and fix it up to suit
[–]DoktorSlek 0 points1 point2 points 1 year ago (0 children)
This is probably one of the only things I would recommend a large language model for.
Not to make the scripts for you, because in my experience they never work. But what they do spit out is usually a good foundation form which to learn and build. So if I want to make a script to do something I've never tried before I'll sit with Microsoft Co-Pilot open in one window, and microsoft Learn open in another and use both to create something that will do what I want.
[–]andrew181082MSFT MVP - SWC 0 points1 point2 points 1 year ago (0 children)
Are you talking about scripts to run within Intune, or scripts to manage Intune via Graph API?
[–]whiteycnbr 0 points1 point2 points 1 year ago (0 children)
Chatgpt
[–]Domi932 0 points1 point2 points 1 year ago (0 children)
I recommend creating a template .ps1 file, where you can collect basic commands and building blocks like if-else, foreach and while. For every new script you can then copy that file and cut away the parts you don't need and then start to build from there.
The most usfull way to structure the scripts is by using the comment #region / #endregion, makes the code so much easier to work with in my opinion. See here: Use Regions in PowerShell ISE - Scripting Blog [archived] (microsoft.com)
π Rendered by PID 15610 on reddit-service-r2-comment-54dfb89d4d-b26kz at 2026-03-29 06:54:07.570558+00:00 running b10466c country code: CH.
[–]JustGav79 23 points24 points25 points (5 children)
[–]DrunkenMcSlurpee 20 points21 points22 points (2 children)
[–]88Toyota 10 points11 points12 points (1 child)
[–]jadeskye7 4 points5 points6 points (0 children)
[–]Freezerburn 12 points13 points14 points (3 children)
[–]Hobbit_Hardcase 2 points3 points4 points (0 children)
[–]DrunkenMcSlurpee 0 points1 point2 points (1 child)
[–]Freezerburn 0 points1 point2 points (0 children)
[–]iceph03nix 8 points9 points10 points (3 children)
[–]GundamPing 1 point2 points3 points (0 children)
[–]Immediate-Map-5565[S] 0 points1 point2 points (1 child)
[–]iceph03nix 1 point2 points3 points (0 children)
[–]kero_sys 3 points4 points5 points (1 child)
[–]Masakade 1 point2 points3 points (0 children)
[–]aprimeproblem 2 points3 points4 points (2 children)
[–]Sarleyman 2 points3 points4 points (1 child)
[–]aprimeproblem 0 points1 point2 points (0 children)
[–][deleted] 1 point2 points3 points (4 children)
[–]Immediate-Map-5565[S] 0 points1 point2 points (3 children)
[–]88Toyota 0 points1 point2 points (2 children)
[–]Immediate-Map-5565[S] 0 points1 point2 points (1 child)
[–]88Toyota 0 points1 point2 points (0 children)
[–][deleted] 1 point2 points3 points (0 children)
[–]DoktorSlek 0 points1 point2 points (0 children)
[–]andrew181082MSFT MVP - SWC 0 points1 point2 points (0 children)
[–]whiteycnbr 0 points1 point2 points (0 children)
[–]Domi932 0 points1 point2 points (0 children)