PowerShell

Why PowerShell is so important for your future …

People always ask me why I concentrate so much on PowerShell. It would work without it. The graphical user interface is excellent and the options in cmd are fantastic. Well, the answer is not easy. I am firmly convinced that the question can only be answered in the future. And that is when it comes to concentrating on new things and automating recurring tasks in order to free your head for new projects.

Most administrators are used to working on servers with a graphical user interface. Many of them may have recognized the introduction of Server Core and Nano Server, but have not paid much attention to it. The Windows books for IT professionals are full of PowerShell commands. That makes many people a little unsure. They lack graphical How-To tutorials.

Why Server Core?

With the introduction of Server Core something has changed in the Windows world. A smaller version of Windows Server with better up-time and fewer Windows updates. A more secure operating system with only the things you need to run it, such as a domain controller or web server.

I often hear these words:”I’m not familiar with Server Core and the command line.” My answer: “That’s not necessary”.

Simply install Server Core and run sconfig. Configure the settings you need and install RSAT on one of your client computers to graphically manage Core. After these words, my students were really amazed. Ok, ok, ok, I have to admit that for enterprise software like Exchange or SQL the desktop version of Windows Server is a prerequisite. But for all other services install Server Core!

By the way, sconfig is also available on Windows Server Desktop Edition. Simply enter


sconfig

Unbenannt

With sconfig there’s no need to be familiar with Windows operating systems. All you have to do is to press 1 to 15 on your keyboard.

Nano Server

Then came the next surprise. Nano server is out. With Windows Server 2016, you can run Nano as a Hyper-V host, DNS server, Web server, or file server. It is similar to Windows Server Core, but much smaller, it has no local logon capability, much less disk space and requires fewer updates. Unfortunately, the next version of Nano will only focus on containers. Nevertheless, Nano is here and will not leave.

1

The significance of the graphical user interface is therefore decreasing. What’s next?

Are One-Liners evil?

This book does not only contain One-Liners! That’s what they often say. My question is: Are one-liners evil? Is a book only a good book if it contains many lines of code? It all depends. If the book is written for developers, then yes. If it’s for IT pros, then no.

When I started using PowerShell in 2013, I was impressed by how easy it is to write small scripts without large numbers of lines. No, One-Liner are not evil, maybe they are a little hard to read, but they follow a logical structure.

PowerShell is a scripting language. The transition from programming to scripting is smooth. To learn programming I recommend C, C++ or C#. I’m not a programmer. I love scripting. Scripts usually get you to your goal faster, but you’re not that flexible.

Here a few examples of One-Liners. If you want to call up 1 to 10, this usually looks like this:


$a = 1; while ($a -le 10) {$a;$a++}

1.JPG

So, and now we see how Powershell can handle this. That’s how I learned it in Powershell books:

2.JPG

Someone has already prepared this for you. Otherwise we would have to use the first example. This is PowerShell.

I must admit that you can learn a lot more in the first example. But in the second example Powershell does a lot of work for me. Let us think ahead. What can we do now with this easy example? We can create some files or users with a simple One-Liner.


1..10 | Foreach-Object {fsutil file createnew file$_.txt 100000}

3.JPG

Fine. We’ve created 10 files. Each file is approximately 100 KB in size.

Last but not least let’s create students from 1 to 10. (local accounts)


1..10 | ForEach-Object {New-LocalUser -Name Student$_ -Password (ConvertTo-SecureString "P@ssword" -AsPlainText -Force)}

4.JPG

How to learn PowerShell?

I am often asked if it is difficult to learn Powershell. The answer is no. Like everything new, the beginning is hard. It is important that you do it yourself. Don’t just watch videos, read books without doing it yourself. No book or video can teach you as much as when you run your own commands and write the first small scripts. They can only show you where you should go and how to do your first steps.

I had a lot of students who liked to listen without being active. In my opinion, none of them will become a good IT pro or developer. That doesn’t mean that these people are bad people, they will make their way, but I don’t see any chance that they will become really good administrators or developers.

Books

I actually decided not to advertise on my blog. Nevertheless, I would like to list some books that are worth reading. The authors are well-known, most of them are PowerShell MVPs (I haven’t written a book yet. I’m a brand-new MVP. I still have baby bonus 😉 )

The best book I’ve ever read is Tobias Weltner’s book PowerShell 5: Windows-Automation für Einsteiger und ProfisUnfortunately only available in German.

Very good books also come from Don Jones. It pays off to take a look at his series “PowerShell in a month of lunches“.

Blogs

There are great blogs around. Mike F Robbins site is a fantastic source for advanced PowerShell enthusiasts. I would recommend searching for the experienced PowerShell MVPs around the globe. Follow them on Twitter, LinkedIn or somewhere else. Last but not least there’s my site coming up in 2017. This MVP award did something to me. Lately, I’ve caught myself that I’m concentrating exclusively on PowerShell 😉

At the end of this post I would like to mention that I decided to write a “PowerShell for Beginners” series in my blog. The first part will be published in January and will deal with the very first basics. I mean the really very first basics. Through my teaching experience I strongly believe that I know how to lead beginners.

Stay close!

Categories: PowerShell

Tagged as: ,

4 replies »

  1. I am accidentally becoming your follower.. I found solutions of some problem I faced in past on your blog.. thanks for sharing your/our wonderful ideas..

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.