Montag, 25. April 2016

PowerShell Tip of the Day

Hi, Everyone

Long time, no see. Last week I attended the AWESOME PSConfEU 2016. Boy (and girl), what a great event, with  a lot of fantastic people and exciting topics. Might be a good time to restart my daily tip series :)

Today I want to show, how we can ensure that a PowerShell script will only run, if a specific module exists on the machine.

It is very simple: we can use the #Requires statement - and I encourage you to read the help site, because there a few other parameter available.

What is happening when we try to run this script?

Dienstag, 12. Januar 2016

Only 98 day till the biggest PowerShell Event 2016 in Europe...

This week the organiser of the PowerShell Conference EU 2016 announced the lineup. There are great people like Jeffrey Snover (yes, himself :) ), June Blender, Jeff Wouters, Ryan Yates, Ravikanth Chaganti and many, many more. Check out the agenda and the exciting topics!

And more important: go ahead and register. There are only 98 days left.

Mittwoch, 11. November 2015

PowerShell Conference Europe 2016

Are you want to meet other enthusiastic PowerShell User from all over Europe? Want to talk about all the stuff that is happening in the PowerShell world? Then you are right at the PowerShell Conference Europe 2016 in Hannover, Germany! This event is happening from 20th to 22nd of April 2016 and is organised by the "Deutsche PowerShell Konferenz" and PowerShell Community Members from all across Europe.

Learn more on the official web page and register yourself for this extraordinary event. You can also follow us on Twitter for the most recent updates.

Dienstag, 29. September 2015

PowerShell Tip of the Day

If you want to write functions, scripts or cmdlets in PowerShell that other people can intuitively use, the first step is to name them descriptive.

Microsoft makes our life easy, because it gave us a list of "approved verbs". You can also output a list of these Verbs in PowerShell:


Please consider this when you create scripts or commands ;)

P.S.: Right now the Azure Con is under way -> ... Take some time to listen in, especially in the keynote to see what's up and what can be done with Azure.

Samstag, 26. September 2015

PowerShell Tip of the Day

Windows 8.1 and Server 2012 R2 got a pretty easy way of telling you who is connected to your smb shares:


The output shows which user - even with which credentials - is connected to which share. It also display the number of connections. Very important is also the property "Dialect".

Donnerstag, 24. September 2015

PowerShell Tip of the Day

Yesterday I talked about Out-GridView. Today I want to continue here and demonstrate what useful stuff you can do.

Lets imagine you want to write a quick script, which let you select multiple processes to be killed. This is a very common task for help desks.

We already saw, that Out-GridView lets you display processes (or any other objects) in a nice table view. If you take a deeper look on it, you will see that you can very easy filter your output:

You can define a filter on every property. This could be helpful if you want to see which processes have a high memory usage for example or if you only want to see a specific program:

But how can we design a "kill processes"-script with that? Well, we need the ability to pipe your selection to Stop-Process. Is there anything out-of-the-box? Our little helper on those questions is the PowerShell help system "Get-Help" ;)

With "Get-Help Out-GridView" you can see that there is a Parameter "PassThru". If we add this to our command, everything we select in our GridView will be send down the pipeline. In our case we will add a "Stop-Process" to the end of our pipeline:

Get-Process | Out-GridView -PassThru | Stop-Process

If you run this command you will see an OK-Button on the bottom of the new GridView window. This will close the window and take everything selected to the next step on the pipeline. The pipe itself will be paused as long as the GridView is open.

So if I want to kill all notepad processes, I select all of them in my GridView and click "OK". And *boom* it will be piped to "Stop-Process" and - if possible - the selected processes will be killed.

So, go on and play around with the GridView. And may the pipe be with you! :)

Mittwoch, 23. September 2015

PowerShell Tip of the Day

Since I have not much time on my hand today, I will just post a quick "tip of the day" - who will be continued tomorrow ;)

One of the many, many, many, many cool things about PowerShell in my opinion is "Out-Gridview" .

What does Out-GridView do? Well "Get-Help Out-GridView" describes it very well:

"Sends output to an interactive table in a separate window."

For Example: it takes the output of a cmdlet - like "Get-Process" - and displays it in an extra (table) view:

This already looks like a nice tool, doesn't it :) But wait there is more...tomorrow ;) But please don't be afraid of playing around with this command until then.