How to get started with powershell

I have been looking at videos on Microsoft Virtual Academy, Pluralsight, blogs on the internet, PowerShell in a month of lunches, and I have picked up some valuable knowledge. Of course, the best way to learn something, is by doing it repetitively.

The thing I am struggling with is where to start… can anyone recommend any scripts that they did when they were a complete beginner to get started? I would like some ideas of scripts I could create myself, and work from there to get better.

I would like it to include functions, parameters, loops etc. so I’m targeting a lot of areas and I can improve my knowledge.

Powershell seems like a great tool, and I would like to invest a lot of time into learning it (should have learnt it a few years ago) I just need some advice on where to start.

thanks :slight_smile:

Anything you did via GUI, Google how to do it in the shell and do it that way.

What is your job role? That would help with giving some more information

Learn by doing. Find a project that you are interested in, and do it in Powershell. In my own case, I had a need to integrate various bits of an e-Commerce site, including Shopify (shop front end) Brightpearl (inventory), Warehouse, and credit-card processing, using REST-APIs. I knew I could have done it in Python or whatever, but I chose PS and managed to make substantial progress all while solving a series of sticky problems for my client. I’m now working with PS to automate manage of Office 365 for a branch office, which involves using PS to manage Exchange, o365, Azure, etc.

1 - Everything you’d normally do at the DOS command prompt or VBScript, etc… start doing all that in the PowerShell ISE or PowerShell Console host or Visual Studio Code using the PowerShell Extension. Using only the normal DOS commands and then do the same with the cmdlets which do the same thing.

Windows PowerShell equivalents for common networking commands (IPCONFIG, PING, NSLOOKUP)

Know that interactive DOS commands don’t work in the PowerShell ISE natively. You can make them work.

Using Windows PowerShell to run old command line tools (and their weirdest parameters)

Note: Sometimes it is just easier to use the old DOS commands, even in PowerShell scripts, because though they may not be as flexible, they are more concise. I wrote a function that allows me to do this sort of stuff to avoid having to type all this stuff all the time.

2 - Read the help files and about_* files, leverage the examples in the help files. Tweak the examples in the help files.

3 - Use any Windows tool that will write the baseline code for you (which you can then tweak), such as the Windows Server 2012 ADAC console leveraging the PowerShell History Viewer.

Active Directory Administrative Center: Getting Started

Active Directory Administrative Center

Step-By-Step: Utilizing PowerShell History Viewer in Windows Server 2012 R2

4 - Make a copy of…
… then, open the scripts, modules, functions in the default Windows PowerShell folder, in the PowerShell ISE or VSCode and review that’s going on in them. Make a copy of them to play with and tweak. Also look for any other location that has .ps files, make a copy and review.

5 - You can also directly look at many of the function code in PowerShell by doing this approach…
Spying on Function Source Code

6 - Get real familiar with the PowerShell Snippets feature. press CTRL+J to see what is there.

7 - Other MS produces and 3rdP vendor products, will show the PowerShell code they are using under the covers. As you use the Window GUI’s pause a minute to look for the code on the screen and copy and save that off for your review.

8 - Continue the video training, MVA, ‘’, YouTube, Plural, etc.

9 - Keep a library of everything you find in a central location, OneNote, doc, or your own module for easy recall / research.

Here’s an idea, and one I am working on right now.

Write a function to change the IP assigned to a record in DNS. A few notes:

  • The reverse record needs to be changed also
  • Take in to account the possibility of a change in subnet

This is proving much trickier than it first appears. (Hint: The Set-DNServerResourceRecord cmdlet has some serious limitations)

Here is what I did. Pick something you do manually multiple times a day/week that annoys you and automate it. It doesn’t matter if it saves you 5 seconds or 5 minutes, just pick one small thing that is relatively simple.

One of my first ones was querying a CSV file for data. We have a login tracker in a CSV file. In order to match a machine with a user, we would open the CSV, do a CTRL + F and find the user or the machine name. Since there could be dozen of entries, it could take some time to find them all. So I wrote essentially a 1-liner that would take an input (a username or machine name) and return all instances of that login information.

All told, I use that PowerShell module about 10-15 times a week and it saves me about 30 seconds each time. Multiply that by a little over 3 years and it adds up to quite a bit of saved time.

Thank you all for the replies I didn’t expect any!:slight_smile:

I work with office 365, azure, Intune, device management with configuration manager etc.

There’s so many options to learn, I just didn’t know where to start with an easy project, building it up from there with powershell


Thank you, really helpful!!!

9 – Keep a library of everything you find in a central location, OneNote, doc, or your own module for easy recall / research.


I personally use one ps1 file called Doodle and put my snipets in there i use all the time.

Yeppers, that is the reason I suggest item #9. we consistently come across stuff, create stuff, share stuff, all is reusable.

I have a single folder tree dedicated to scripts (since my early DOS days),
Tools,Add-ons and snippets.

That library alone is 24+GB and growing (of course fully archived in multiple places, just in case). Every piece of code I’ve ever written, downloaded, copied, borrowed, etc. is in there since the 1980’s.

For my daily PoSH, efforts, I have a single ModuleLibrary.psm1 I created a long while back and update it all the time, which is set to import via my profile in ISE, VSCode, and Console host. It of course has grown a great deal over the years, so far over 5K+ lines of code and comments, etc.

Other modules of in daily use and loaded with my profile.
MS Module Browser = 2,170 modules in that remote library
MS Script browser = 25,333 scripts in that remote library
MS Script Analyzer
MS Project Explorer

PoSH ISE development - Tools / add-ons with a look…
IseePack - Free

IseSteroids (not free - but good stuff)

Of course adding these sort of things, will slow down the ISE startup, so be patient, it’s well worth it.