One bit of feedback we frequently get is that PowerShell’s learning curve has some steeper bumps than we would like. Or simply, is strongly affected by habits learned from other languages or shells. Interestingly enough, many of these problems aren’t new to us – we just don’t have a good way (aside from help) of exposing them to the user. This was something I touched on in the footnotes of a blog in 2005, and started implementing personally shortly after that.
One tension that sometimes arises in the PowerShell community is between the hard-core developers, and hair-on-fire administrators. As a broad technology, this tension and desire for balance drives our design decisions every day. PowerShell is all about striking a balance between a range of experiences: Task oriented, and consumption-only. AKA “Copy and Paste Admin.” How do I use PowerShell to restart a computer? Problem oriented, and composition-based. AKA “Admin Scripter.
Pain is Temporary … Quitting lasts Forever. I hadn’t heard this before yesterday, but it makes a good quote for the whiteboard!
Once problem that often arises when trying to manage machines is when the management layer itself is the thing you need to diagnose. For example, trying to diagnose Remote Desktop connectivity issues when port 3389 is blocked, or using PowerShell Remoting when WSMAN is misconfigured. Alternatively, you might not have the client you need to manage the machine – such as an SSH client, or a version of PowerShell V2 installed.
If you have a PowerShell script that you are calling from cmd.exe, you might run into the following error: Write-Host : The OS handle’s position is not what FileStream expected. Do not use a handle simultaneously in one FileStream and in Win32 code or another FileStream. This may cause data loss. This is bug in PowerShell V1 and V2, and happens when: a PowerShell command generates both regular and error output you have used cmd.
Once in awhile, we get questions about the best practice for PowerShell’s execution policy when it is included as part of a standard desktop image. This is one of the main reasons that PowerShell ships with a “Restricted” execution policy. Since you have to explicitly enable or install PowerShell, we’ve frequently been asked why we aren’t more permissive by default. After all, you did just install / enable it! The reason is that separating the execution policy decision from the installation decision gives you a lot more freedom on installing PowerShell.
Last night, I flew my first half-hour as Pilot in Command of N8756C, a 1977 Piper Warrior. In flying, a pilot’s First Solo is a huge milestone. After hours of training and ground study, you finally take to the air on your own. The most difficult part of flying is getting back down, so the First Solo is three takeoffs and landings – about half-an-hour in the traffic pattern. It seemed to be the flight that would never come, though.
One question that comes up fairly often when dealing with (or writing!) secure cmdlets is how to properly handle usernames and passwords. The solution there is to use (or make) the -Credential parameter of type PSCredential. A PSCredential object helps ensure that your password stays protected in memory, unlike cmdlets that accept a straight username / password combination. If a parameter is of type PSCredential, PowerShell supports several types of input:
After what seems like an eternity, I finally got to start my official flight training. As a Canadian (AKA “Alien,") applying for flight school also means getting your fingerprints taken and being put in a special registration system. My training permission cleared late last week, so I booked my first lessons as soon as I could. In fact, for a government agency, the flight registration process was surprisingly efficient. Finding a place to get TSA-approved fingerprints outside of work hours?
Once in awhile, you’ll see a PowerShell screenshot that is still black and boring like the traditional cmd.exe prompt. Other times, you’ll see the fancy blue window you’ve come to love. Why the difference? And if you’re suffering from black window syndrome, what can you do about it? Before shipping Version 1, our marketing and design teams set to make the PowerShell window a unique and marquee experience. What form did this take?