Powershell IS for the desktop tech as well

Every day some one tends to ask me if there is a simpler way to do task A or B, and the minute I mention PowerShell the response is almost always the same, “yea i have been meaning to learn that but<fill in some excuse here>. This really saddens me for 2 reasons,  1) Because PowerShell can and does make your life simpler  2) i am already seeing peoples jobs get replaced when they fall behind in the skill and as more and more companies move closer to automation it will only get worse.  It saddens me even more so […]

Building a test lab : The basics Part 1 RootCA

Part of building a functional test lab is being able to deal with cattle and not pets. With that in mode I’m writing a series about the script necessary to build a production like lab for testing DSC, and be able to to tear it down and rebuild it with little effort. Part 1 is about bootstrapping DSC for the Root CA. and doing so without using plaintext passwords. I would welcome some feedback on both my methods and writing style. Building the basics Part 1 | PKI: RootCA No related posts.

RabbitMQ and PowerShell

Have you ever needed to communicate between scripts, perhaps running on different servers and in different languages?  Did you use a non-standard “messaging” solution like the file system or a SQL database? Did you try to avoid this and squeeze everything into a monolithic, delicate script? RabbitMQ is a solid messaging solution that happens to have a handy REST API and .NET client, which means we can use PowerShell! Wrote a quick hit on setting up a simple RabbitMQ deployment and using PowerShell to manage the solution and send and receive messages. Thanks go to Mariusz Wojcik and Chris Duck […]

Decorating PowerShell Objects

Ever wonder how PowerShell seems to know how to format objects? When you run Get-ChildItem or Get-WmiObject, you only see a few key properties, but a wealth of other information is available through commands like Select-Object and Get-Member. Have you ever written a PowerShell function that you nearly always pipe to Format-Table ? Wouldn’t it be nice to specify some default properties and force them into a table? Stop by for a quick hit on how to decorate your PowerShell objects with type names and formatting, including a re-usable tool to abstract out some of the details. Cheers! No related posts.

Walkthrough: An example of how I write PowerShell functions

A couple of days ago I posted a blog article titled “PowerShell function: Test-ConsoleColor provides a visual demonstration of the foreach scripting construct” and today I thought I would walk you through that function step by step since it’s what I consider to be a well written PowerShell function. It starts out by using the #Requires statement to require at least PowerShell version 3 or it won’t run. It also requires that the PowerShell Community Extensions module be installed since it uses a function from that module and continuing without it only leads to errors: #Requires -Version 3.0 -Modules Pscx The function […]

Improved Function: Get-ComputerDetail

Fellow coders, I received some great feedback from our honorary scripting guru’s Mike F. Robbins and Richard Siddaway about my little function (thanks guys! I’ll buy you a drink when we meet! 😉 ).

With their feedback I managed to improve my simple function. And that’s so great about being part of a community; people are always willing to help.

Update – What’s your favorite PowerShell Editor?

On june 9th, I’ve started a survey about the most popular PowerShell editor around: What’s your favorite PowerShell Editor? I have some results for you now, and it’s quite clear. Till now PowerShell ISE is the most popular editor. Well done Microsoft! But please keep sending in your votes, let’s make this the ultimate survey! Vote here: Survey Related posts: Working on a new PowerShell module: ProtectedData What’s your favorite PowerShell Editor? Getting a list of Windows Language Locales with Windows Powershell The Monad Manifesto Annotation Project

Function: Get-ComputerDetails

Another nice addition for today. In the Powershell.org forums someone asked for retrieving computer information. This information is being retrieved from several WMI objects, and had to be combined in the results. For this PowerShell custom objects are the perfect fit.

Function: Expand-ZipFile

Fellow coders, I’ve got a quick and dirty function for you. I had the requirement to extract zip files from a particular directory. Of course you could do this with Expand-Archive (new in PowerShell 5). But there’s a problem with this little rascal; it does not keeps the timestamps of the zipped files intact. My customer wanted to keep these timestamps intact, because they use it as a indicator to see if the file is older or newer what they already have. So I made a quick and dirty function, which uses a .NET assembly. I based this function on […]

Why Remoting vs. SSH Isn’t Even a Thing

As you’ve probably read, Microsoft recently announced that they’re getting on board with SSH, and that they’ve plans to, in some future-and-unspecified version of Windows, include a default SSH server and client. Some folks have taken to the Twittersphere rejoicing this decision, even though I suspect they’ve no idea why Microsoft is doing it. Others have suggested that this is the downfall of Remoting (management via WS-MAN), because who would want that when you’ve got SSH? And so now I have to write this. First of all, let’s speculate – with some objectivity – why Microsoft is getting involved with SSH […]

Trust, but Verify

The PowerShell code you write can turn up in interesting places. Production services might rely on it. Your co-workers might take a peak and borrow ideas from it. You might decide to share it online. Someone might see your code online and use it in their own solutions. Hit the link for a quick bit on how we can help create more reliable, consistent, and secure solutions. Simplified to one line: always ask yourself “what could go wrong?” What do you think? Is this over the top? Do you have any funny or awe-inspiring-train-wreck stories that resulted from assumptions around […]

DON’T Start Learning PowerShell?!?!?

Jason Helmick and I were recently up in Redmond recording a Microsoft Virtual Academy series entitled, “Building Your Datacenter One DSC Resource at a Time.” While we were there, we decided to film a tongue-in-cheek promo for the series that started with the premise that, “if you haven’t already learned PowerShell, you missed the bus.” Obviously, there’s a bit more to the story. No related posts.

Creating a small footprint, base image Part 4 | Bringing it all together with automation

In this entry I combing all I covered into a set of scripts to automate the process of creating a small footprint VHDX base image and a WIM to use a sorce that is fully patched. And I added a script to update the files on a regular basis. Check it out and let me know what you think. Creating a small footprint, base image Part 4 | Bringing it all together with automation Related posts: The current and future state of the Windows Management Framework PowerShell… An exciting frontier… The Monad Manifesto Annotation Project Series – Microsoft Certification the […]