Scripting Time is Here

As has been my usual way of driving the world Bananas for the past 7 years I have two things I have done traditionally in the month of December

Write a series of Holiday Silliness in PowerShell for Hey Scripting Guy

Write a correspondingly badly sung tune for the series.

… thus we have for the 7th Annual Scripting Guys Holiday Special on

“Scripting Time is Here” – Lyrics and horrid video


Scripting Time is Here
PowerShell so dear
Systems run, my work is done
My alerts are in the clear

Cmdlets everywhere
Manage all with care
PC, Mac and Linux too
Remoting Through and Through

The Days end calls to me
I search the Gallery
Modules there, and Scripts as well
And Github there to see

Scripting Time is Here
Happiness is clear
Deployment done with DSC
So simple as can be

Yappie nerds…
I just not sure I understand the meaning of scripting
What do you mean?
Well I mean, really who wants to go home on time?
What?  What are you yammering on about?
I always thought staying in the Office for 18 hours a day was cool
Are you pulling my leg?  Wouldn’t you rather be home, relaxing with Family?
You mean Stinky?
Who’s Stinky?
My Bunny Rabbit
You have a Bunny Rabbit called Stinky?
No, he just smells bad.  His name is Karl.
Fine, wouldn’t you rather be home with Karl the Bunny? Earlier?
Well that’s what Scripting is all about, Consistency and getting home Earlier to Karl the Bunny.
Oh well, I never thought of it that way

The Days end calls to me
I search the Gallery
Modules there, and Scripts as well
And Github there to see

Scripting Time is Here
The days end draws so near
A single line, does work for me
I head home and I am free….

Working with the new System Path Editor in Server 2016 RTM

If I were to ask how many of you LIKE editing the System Path in Windows I’ll bet I wouldn’t see a lot of hands up in the room.  I specifically wrote a function in PowerShell to edit the path for that reason.

As the path grows it becomes difficult to manage.

In Windows Server 2016 RTM there is a new Path editor (And it’s very easy to find and use!)

Drill down to the Environment Variables as you would normally under “Advanced Settings”



When you go to view your paths, especially the SYSTEM Path there’s a new cool option, it brings up a nice GUI Editor.


“Wow! This makes editing the path WAY better!” I thought but watch out… it’s a new Feature with some “undocumented features”

If you Choose “Browse” to select a path you’ll notice something, it’s missing the extra ‘\’ which I found causes some applications to miss that folder in a Search



You can of course easily highlight the entry and add in the missing ‘\’


The other one to watch out for is the “New” button to Add an entry.   If you click on “New” and try to immediately Browse to a folder you’ll find it deletes the entry above it.


That can’t be good!


But the solution is easy.  Click “New” and begin typing something … ANYTHING in the new Field and THEN browse away… Just again remember to add in the that missing ‘\’ when you’re done.

It was actually this feature that caused me initial issues with PowerShell 6 Open Source in that I browsed for C:\Program Files\OpenSSH and the entry was missing a ‘\’ at the end.  This caused PowerShell to skip over the folder as a file when searching for SSH.EXE

Bug in OpenSource PowerShell PSRemoting (6 release 9 and 10) and Workaround

I’m doing a talk at MVPDAYS on Open Source PowerShell and one of the items I was most excited about I had to try… PowerShell remoting!

In the current release it’s still an interactive PowerShell session but it’s amazing what it will bring forth.   The option for a Windows Admin to remote to a Linux/macOS system with a PowerShell script from Windows!  Or simply to consume the text data from Linux and flip it to objects.   Natively converting Json and XML!

Or for the Linux admin stuck with some Windows Servers.  It means running your native Bash, firing up a PowerShell command to manage those Windows Servers the Business brought in… or in the long term using Cmdlets provided by Vendors like Dell to manage applicances…

It’s all about OPTIONS for the Admin.

But today I REALLY wanted to play with PowerShell remoting.   Jason Helmick showed it online with Jeffrey Snover and it really IS is.   Requirements are pretty simple too.

  • Open Source PowerShell at both endpoints
  • OpenSSH on a Linux / macOS
  • SSH_Win32 on Windows
  • Some minor configuration

And use is just as easy.

New-Pssession –hostname ComputerwithSSHServer –username whoeveryouare

After a password prompt you just connect and you’re in the OTHER side using PowerShell!

I had everything loaded up, the most current release of PowerShell from Github on Windows and Linux, Open SSH, followed the instructions to the letter and

bbbbzzzztt! nothing

Windows would not receive the open connection Linux with some weird cryptic error.  Linux could not receive from Windows.

Jason suggested the first thing which was “confirm SSH” works.   Which I did.    Pretty easy test too

SSH username@server


I poked about online and saw a reference from Microsoft regarding a bug in which the SSH_Win32 would drop a blank line with a successful connection in STDERR .   Since it was a recent bug and Jason had demoed the Open Source PowerShell with PSRemoting maybe a tad early than that… I guessed there might have been a bug somewhere about.

So stage one.  Rollback to PowerShell and one version EARLIER of SSH_Win32.

Once I did THAT Linux happily connected to Windows via PowerShell Remoting!



(yeah there’s always a But somewhere)

Windows still could not initiate the session.   Evil vile cryptic error message about he Endpoint having finished already. However in running through the troubleshooting (Running the SSHD in Diagnostic mode) I could see the connection didn’t FAIL it just NEVER ACTUALLY HAPPENED.

“That’s it! Pull out the big guns!  Mark Russinovich will LOVE THIS!  We’re going to use a Sysinternals tool to fix a buggy feature in PowerShell 6!”

Procmon.exe was downloaded.  I set it to only watch powershell.exe for events.   Cleared off the old events of course.

Started the New-Pssession –hostname eotubuntu –username energizedtech

Watched the fail

Stopped monitoring

Get rid of all the successes on the filter

Now…. LOOK


Drilling back the most recent set of entries I noticed a search through various folders for SSH.EXE and GET-SSH.EXE.  Including an interesting one.

‘C:\Program Files (x86)\Putty’

But I never had Putty on this server! It was a clean Server 2016 RTM.   Which told me…. (no no wait… looks like I did!)

Here’s the list it found


But on Server 2016 it CLEARLY showed C:\Program Files\OpenSSH in the system path…. which was wrong.

It should ACTUALLY have been C:\Program Files\OpenSSH\ (Notice that extract Backslash? I DIDN’T)

So I re-edited the path to hold it and now it all works properly.

Why was it missing the Backslash?  I used the new “Browse for Path” feature in the Path Editor of Server 2016.   It did it.  Must be an undocumented feature.

With that change in place I could happily run PowerShell remoting from Windows to Linux or Linux back to Windows

….Can’t WAIT for Implicit Remoting !