Run Background Commands after Every Command

There was a time in the not so distant past, where I specifically remember wondering how I might be able to get something to happen, every time any command ran in my Windows PowerShell console. And, I don’t just mean commands. Any operation, or error, or fat fingered mess, followed by a press of the Enter key. We know that things happen in between commands. The list of commands in the current session history, and the $? variable, are updated as one command completes, and the console readies itself for the next instruction. So how does one take an action, […]

Using Package Management in Windows PowerShell v3

Hey now! The PowerShell team published a preview version of PackageManagement for Windows PowerShell v3 and v4. As it happens, I have a Windows 7 SP1 box running PowerShell v3–why not run a little experiment? $PSVersionTable.PSVersion Major Minor Build Revision —– —– —– ——– 3 0 -1 -1 Preparing the Environment You need .NET Framework 4.5 or later, so take care of that prerequisite before you install the following two assets: Windows Management Framework (WMF) v3 PackageManagement PowerShell Modules Preview I restarted the computer after each installation just to be safe. Before we proceed we also need to relax our […]

Automate Sip Address and UPN name changes in Lync / Skype for Business

Name changes are a common occurrence in the world of IT and usually the primary concern is the e-mail address. Exchange e-mail address policies will handle this for us but often times the Sip Address and User Principal Name are left behind. I tackle these changes with an automated way of changing the Lync / Skype for Business sip address (also known as sign-in address) and User Principal Name to match the e-mail address. I also include the link to download the Lync / Skype for Business meeting update tool that is required when a Sip Address is changed. Head […]

Export Subnets from Active Directory Sites and Services

I am back this week with a quick write up on how to export your network subnets from Active Directory Sites and Services. Active Directory Sites and Services subnet assignments are important for healthy replication and for location based services to function properly. The need for this information has come across my desk on several occasions. Even a quick print out would be extremely helpful to keep at your desk.  I have included both Windows 7/2008 and Windows 8/2012 methods to ensure everyone is covered. Head on over to for the full article. As always, leave a comment and I […]

Testing PowerShell Direct with Windows Server 2016 TP3 Hyper-V

Hey there! I  thought we could test PowerShell Direct together today. Here’s the elevator pitch: In Windows Server 2016 and Windows 10, we can send PowerShell commands from the Hyper-V host directly to its corresponding virtual machines (VMs), even in the absence of guest VM networking. Yeah, that’s cool, isn’t it? What’s just as impressive is that PowerShell Direct works even if PowerShell remoting is disabled on the guest VM! PowerShell Direct also circumvents Windows Firewall. Note that PowerShell Direct requires that commands are sent only from a Hyper-V host to its local VMs. Also, PowerShell Direct is supported at this point only by Windows Server […]

TechSession Webinar: Object-Oriented Function and Module Design

Join Adam Bertram as he explains how to take your modules to the next level. You’ve used PowerShell to scale out your infrastructure, now learn how to design modules you won’t be afraid to touch in 10 months. It’s time to graduate from procedural scripts to object-oriented functions. Click here to register for the session. No related posts.

Finding Evil LDAP Queries

Have you ever wondered what LDAP queries were hitting your domain controllers? Even outside of fun investigations, it can be insightful to get a sampling of queries hitting your domain controller. The more services you have integrated with Active Directory, the more likely a vendor or sysadmin unwittingly configured their service to produce evil queries. Mark Morowczynski from Microsoft wrote a great post on finding these expensive, inefficient, or long running queries – But something was missing. Screen shots of regedit? If you have more than a handful of domain controllers, enabling and disabling this logging is going to be quite […]

Delete Specific E-Mail or E-Mails From All Exchange Mailboxes

Well this is week number two in my quest to post an article once a week and I am back with a common request for Exchange administrators. There are a lot of scenarios that bring up a need to remove an e-mail or e-mails from all mailboxes in your environment. Perhaps there was a disgruntled employee, a virus outbreak, or a reply all to the whole company. We all know that the “Retract” button is best effort (yes I still miss GroupWise for that purpose). As always we can turn to PowerShell for our scripting needs. The Search-Mailbox command is […]

September Recap and October Teaser! – CincyPowershell User Group

We had a great time last week learning how to take code and make is shareable and reusable.  We learned about variables, scripts, and functions.  We were challenged to create your own function to check for free space on any computer. Summary of the night : Would you like fries with that? or Learn Powershell / DevOps….you choose!  October Teaser: We have a special guest speaking at our next meeting on October 27th.  We’ll be talking PowerShell, Storage, SQL and more!  Stay tuned for the event and announcement.  You won’t want to miss this session! Special Thanks to our sponsors Sapien […]

How to handle oAuth from PowerShell

One of the coolest features of PowerShell is the many tools we have available to work with services on the web, be they SOAP, REST, RPC or even WSDL services.  It’s no question, PowerShell makes it very easy to pull down data from any of these places. Unfortunately, getting data from a service isn’t always as easy as embedding your credentials in a URL. In fact, some services require us to authenticate and ask the user for permission before giving up the goods.  For these, oAuth is the de-facto standard for delegated access.   In this blog post today on […]

Automate enabling and disabling Lync / Skype for Business users

Hello community, This is my first post here at, and I have a goal of posting tips, tricks, articles, and solutions once a week. My first exposure to scripting was on my x486 computer. I would always create .bat files to launch my DOS based games from the root folder. I learned complex scripting through the use of VB Script, automating the roll out and updating of Windows 2000 desktops and servers. I quickly transitioned to PowerShell as my preferred scripting language upon its release. I use PowerShell on a daily basis to administer Windows Server, SQL Server, […]

PowerShell Scheduled Jobs and Tableau analytics

Here’s a brief rundown of how we leverage a few Cmdlets from the PSScheduledJob module to manage our Analytics stack. For those of us on the Analytics team at Pluralsight, PowerShell is the lynch-pin which binds our two worlds together. To manage the gaps inherent in all platforms (since one tool would be hard-pressed to cover all areas), we use PowerShell to link the worlds of Data and Analytics (and back). We do this because of its depth and the ease with which we can automate just about anything.               All that said, we leverage […]

Take home from PowerShell Summit Europe

WOOHA it’s been a great week. I sat down last night my brain all fried and tried to compile a list of things to remember from the past week. There is  much focus on “changing the mindset” of the community. Get into the DevOps mindset and become a toolmakers. This is my take-home from the conference. There’s no way to summarize all of the conference other than to say: Look forward to the videos on YouTube. Stuff to read: A great short read about “Toolmaking“ Steven did a DevOps Reading list. Concepts: Iain Brighton‘s talk “Man vs Testlab”. I’m definitely going home […]

Store Secured Password in PowerShell Script

Automation is awesome, but what if you need to run a script with elevated privileges?   If you are following security best practices then the account you login with most likely doesn’t have the required elevated privileges.  Storing your password in plain text in your scripts is no good either.  So what do we do?  There are several options and each has there place, but I’ll show you my favorite below.  Check out the full article by clicking on the link below.  While you are there check out some of my other posts, the script repository and the resource page. Store […]

Find Stale Accounts in Active Directory

Find Stale Accounts in Active Directory Everyone who has managed Active Directory knows that keeping it free of “stale” accounts is a tough task.  Typically no one cares about this until it’s time for the Microsoft True Up.  Then we’ve got to hustle to get rid of all these unused accounts before we have to pay for them again!  Pre-PowerShell it was tough because well… you didn’t have POWERSHELL!  Now the hardest part about finding these accounts is defining what stale means to your company.  There is no right or wrong answer to this question, but there are some things that […]