The Two Step Guide to Upgrading to PowerShell 5.1

PowerShell 5.1 has been out now for nearly a year, but I’ve found that many companies have yet to upgrade. Perhaps the reason they haven’t updated is that they’re at PowerShell 5.0 and don’t see the need to upgrade or they’ve built code in the v2 days where they feel like something may break. If you do decide to upgrade, I’ve created a technical how-to with some scripts to automate this process for you. Disclaimer: All code mentioned in this post is as-is. Some may work, some may not work in your environment but, if you have nothing, to begin with, it will act as a template for you to start with. Since I’d just be repeating what sites like like the PowerShell 5.1 release notes and the installation help that Microsoft provides for 5.1, this isn’t going to be about 5.1’s features but rather a tactical how-to on getting […]

Read more

A Better PowerShell Start Process

We can start a process in PowerShell many different ways. We’ve got the PowerShell Start Process and Invoke-Expression cmdlets, we can call the executable directly or use the ampersand (&) to invoke expressions. The most common way is to use Start-Process because it’s probably the most intuitive. PowerShell is known for it’s intuitive approach to command naming and Start-Process is an excellent choice. However, that command is limited. To understand why Start-Process and all of these other commands are limited you first have to understand how a typical EXE file works. When an EXE file is run, it performs whatever action it was designed to do; it pings something (ping), starts a software installer (setup), looks up some DNS record (nslookup), whatever. For this part, Start-Proces and other commands to start a process work great. It’s simple. The limitation comes when that EXE returns some output. Streams An EXE file […]

Read more

Stop Analyzing and Start Doing!

I’m an engineer and developer and if you’re a regular reader of this blog, you might be too. We are known for our left-brained, logical thinking. We pride ourselves on designing solutions by designing and thinking through and analyzing lots of potential pitfalls. Afterall, we want to build a great solution that not only solves the immediate problem but can stand the test of time! Why solve just the immediate problem? While we’re at it, why not try to think through every….single…use case? We wouldn’t be good engineers if we only solved the immediate problem and moved on, right? That would be a major hack! No. Just no. There are times when it’s critical to spend lots of time up front on tasks thinking through everything that could go wrong. But, we’re not structural engineers or high-rise architects. We’re automation enthusiasts and developers! Developers work with text; not load-bearing walls that […]

Read more

A Scripting Automation Success Story

One day a few months ago a client of mine came to me with a dilemma. They had a massive employee onboarding process that consisted of creating a name badge, providing a laptop and phone, creating an account in their phone system, creating an Active Directory account, a home folder and a lot more activities. Every time a new employee came onboard, HR would send IT an email notifying them of the employee’s name, department, etc. IT would then create a bunch of help desk tickets for all of the required activities and send them off to the responsible parties. The IT director was frustrated because when the process was finally completed, multiple weeks would go by and usually the employee would always request something that the team had forgotten. The director was at his wit’s end, but someone on his team stumbled across my blog when trying to create […]

Read more

The Introvert’s Guide to Tech Conferences

Today I nearly watched someone die because the awkward feeling of standing next to a group of people at a crosswalk was too much. It was during the early morning walk to the Microsoft Ignite conference. Myself and a group of other attendees were waiting for the all-clear to cross a highway when I saw someone join our group briefly. This guy quickly eyed our group nervously and then immediately begin to cross the road with a definite degree of determination. As he crossed the four-lane highway, I couldn’t help but think about his choice to sprint across a busy road risking his life rather than waiting a couple of minutes. Was it because he was, in fact, too uncomfortable to stand amongst strangers or was he simply in a hurry to get to an early morning session? The way he was acting led me to believe he simply didn’t […]

Read more

#PSBlogWeek: PowerShell Blogging for an Entire Week

UPDATE: #PSBlogWeek submissions have ended. Do you have a blog? Do you like to write about PowerShell? Do you want more exposure to your blog? If you answered yes to these questions, #PSBlogWeek is for you! What is #PSBlogWeek? PSBlogWeek is a week-long blogging event we here in the PowerShell community occasionally do to train others about PowerShell but also get exposure to various blog and bloggers around the world. For a recap of the last #PSBlogWeek check out this post. PSBlogWeek is an effort on various bloggers’ behalf to come together to promote each others’ work. A common theme is chosen, each blogger decides what to write about from that theme, and each day of the week one of the blog posts are posted. It’s that simple! As each post is ran, yourself, your fellow bloggers and undoubtedly others in the community will then promote your post as being […]

Read more

Be Wary of PowerShell’s OutputType Keyword

Whenever creating an advanced function in PowerShell, it’s always a good idea to define what type of object the function will return by using the OutputType keyword. I wrote a little article about this awhile back if you’re unfamiliar with the concept. OutputType is a great way to show what type of object the function returns as well as assisting in tab-completion as you can read from the link. However, I’ve noticed an issue that’s tripped me up twice now and thought I’d write something on it. When using OutputType, you’ve got a couple different ways to define the object type. You can either define the expressed object type or define the object type in a string. .NET Type –> [OutputType([System.String])] String –> [OutputType(‘System.String’)] For ages, I always preferred to use the .NET type because I thought it was more explicit however I’ve been burned twice now and have started using the […]

Read more

SysKit Enterprise Server Monitoring and Administrative Tool

Disclaimer: This is a sponsored post paid for by the tech vendor Acceleratio. However, I will always stand by all content produced because Acceleratio had no input as to the opinions of this post; only to point out technical inaccuracies. Acceleratio is a leading software company located in Zagreb, Croatia. Founded in 2009, the company quickly evolved into a leading provider of software solutions for SharePoint, Office 365, Microsoft’s Remote Desktop Services (RDS), and Citrix server environments. Acceleratio’s core software products include SPDocKit, SysKit, and SQLDocKit. SysKit, formerly known as Terminal Services Log, is their server monitoring and reporting solution. It helps administrators effectively manage a variety of system environments and machines, providing clear insights into server performance, user activity, system inventory, and application usage. Ease of Use One of the striking features of SysKit is how easy it is to install and use. You can download the 70 MB […]

Read more

Automating NuGet Publishing to the PowerShell Gallery

As you put time and effort into that awesome next script or module, what happens to it after it’s fulfilled its immediate use for you? Chances are, it’s probably doomed to be forgotten in some long-lost folder provided value to no one. Just because you’re done with it doesn’t mean that you should just abandon it. Why not spruce it up a bit and share it with the community? I can hear you now, “but…but..there’s requirements that must be met that I don’t feel like doing and, besides, my code isn’t good enough!”. Well, the first complaint I’m about to show you how to remove but the second is up to you to decide. To push code to the PowerShell Gallery, there has to be _some_ kind of requirements. However, if you look at the current requirements, you’ll see that Microsoft isn’t asking for much. In any case, it was […]

Read more

How to Create a Wait-Anything function with PowerShell

Have you ever needed to wait for some other tasks in a script before proceeding to the next? Sure, we have the -Wait parameter on a lot of commands but not everything that we’re willing to come across will be that easy. In order to prevent me from reinventing the wheel every time, I decided to create a generic Wait function that would wait on anything. When it comes down to it, a wait task only has three components: Conditional code to execute to determine when to continue. Conditional code to return $true or $false representing to continue waiting or not. A timeout to ensure the code doesn’t wait indefinitely. We can build a tool that incorporates these three components with a scriptblock that returns a boolean value ($true or $false), a while loop to continually execute this scriptblock and a timer to track how long this process is taking […]

Read more
1 2 3 4 5 24