r/PowerShell • u/kriskris0033 • Aug 18 '18
Question Need beginner level script ideas to learn powershell
I work mostly on servers and I never coded in my career, I kind of think I can't do it, but now I needed it alot at work and I need to learn it, so need some beginner level script ideas to learn powershell
57
Upvotes
View all comments
4
u/swimjock Aug 19 '18
I was in similar boat, always a GUI win admin and never really felt that I would be able to apply any scripting when I worked at an MSP because of the unique nature of have different client environments
Since then, I got a new job that needed an AD audit rewritten, current state was horrible with multiple single use scripts and multiple calls to disk making the process take forever, 30 minutes to a hour. We we're at a slow period for the holidays and got to work learning how that iteration works and where it could be improved. Got the whole run time to under 5 minutes when I finished with a single script that took parameters from in line or a json file.
Like others have said 'script repetitive tasks,' this a great place to start, but I still had a hard time with it. Thinking I didn't do anything repetitive enough or that it couldn't be scripted. However having learned enough to be quite comfortable with powershell I can tell you that there were many things that could have been scripted and usable across across those many different client environments.
Here is my recommendation.
Take the top five of that list and break each task down into it's individual parts and build each step into a single line.
After you have been working with the language for a free month revisit your earlier scripts and see if you can improve them.
Also a version control system is something you should learn and use, if you have the means, as you script with repos for each project.
Finally, post questions here, the community is fantastically friendly and knowledgeable. The shortest script is something worth reading to see how other people write. Read the unofficial best practices for powershell, it's fairly quick.
Feel free to PM me if you want.