I have recently become a firm believer that every Windows administrator should learn and use PowerShell, I know many people have known this for years but at least the penny finally dropped for me.
Using PowerShell, either for day to day administration or to automate regular tasks will make things so much faster and easier and give you more time to research/study/work on stuff you actually enjoy. Firstly I want to show you three quick commands that can make working on your local workstation/server faster. These three are very easy and only scratching the surface of what can be done.
Checking a service is running. I chose the W32Time service but it could be any. Sure opening the services console and finding the service in the list is easy but it isn’t as easy as this:
Maybe you want to restart the service? Try the following.
Get-Service -Name W32Time | Restart-Service -Verbose
Or maybe you want to quickly check the last 5 Microsoft updates that have been installed on your computer? That can be done like this.
Now the above are some pretty cool things but you are only really working on your local machine so it isn’t going to speed things up that much. Where PowerShell really stands out is taking a task that would take you all day to do in the GUI and completing in in a few seconds in PowerShell. Here is a good example.
You need to get a list of all your user’s Names, Email Addresses and Office Phones out of Active Directory. You could go to each individual users properties in Active Directory Users and Computers and spend all day writing the info down, or you could do one line of PowerShell and let it do the work for you:
Get-ADUser -Filter * -Property * | Select-Object Name, EmailAddress, OfficePhone
Finally you may want to get a list of names all the Windows Servers/Computers you have in your domain. You could go through Active Directory Users and Computers and write them all down or you could do this:
Get-ADComputer -Filter * | Select-Object Name | Sort-Object Name
As you can see PowerShell really can make your life a lot easier, it is also great fun to learn. So why not give it a go?
If you are keen to learn then check out this post for some great info on where to start your PowerShell journey.