List users logged on to your machines

Password policies are the best ūüėÄ Sometimes they lead to account logouts when someone forgets to logout of a session somewhere on the network though. It might be the TS session they use once a quarter for reporting or maybe you know the feeling when you RDP to a server only to find that it is locked by 2 other admins¬†who forgot to logoff when they left. (Off cause this never happens‚Ķ we all use PowerShell‚Ķ) Anyway, this had me searching for a user session somewhere on the network. The worst thing¬†is when my own password expires. I hate when […]

Multithreading using jobs

Often I have had to check something against all servers or clients. A classic problem and every time I run into the¬†it it’s time consuming and running the job multithreaded would be nice. A few years back¬†I¬†found a nice little script for multithreading which I have been using quite often. Unfortunately this wasn’t a module. And I can’t remember where it came from. So this week¬†I set my mind on recreating this as a module and to see if¬†I can publish it on PowerShell Gallery. Version control 101 I¬†recently watched the crash course¬†Warren did on youtube¬†a month back and I […]

TEST IT: New IISAdministration Module

It’s no secret that Microsoft’s WebAdministration module isn’t universally loved. It’s functionality isn’t deep, and it doesn’t play well in the PowerShell pipeline. There are also a number of things in it that run really slowly, making bulk administration a pain. Last week, Baris Caglar announced that Windows 10 contains a new IISAdministration module, which is a rough draft of what is hoped to be a final module in Windows Server 2016.¬†If you use IIS, get hold of this and start testing so the team can get feedback. Note that this is a¬†feature of Windows 10;¬†I haven’t yet been able […]

Abstraction and Configuration Data

Modularity and abstraction are a huge benefit in scripting and coding. Which of the following blocks of code are easier to understand? $SQLConnection = New-Object System.Data.SqlClient.SQLConnection $SQLConnection.ConnectionString = 'Server=SqlServer1;Database=MyDB;Integrated Security=True;Connect Timeout=15' $cmd = New-Object system.Data.SqlClient.SqlCommand("SELECT * FROM Table1",$SQLConnection) $ds = New-Object system.Data.DataSet $da = New-Object system.Data.SqlClient.SqlDataAdapter($cmd) [void]$da.fill($ds) $SQLConnection.Close() $ds.Tables[0] Or… # Invoke-Sqlcmd2 -ServerInstance SQLServer1 -Database MyDB -Query 'SELECT * FROM Table1' If you aren’t a masochist, the latter probably looks a bit nicer. Oh, and it offers other parameters, error handling, parameterized SQL queries, built in help, and other benefits the .NET code block misses. The takeaway? You should be […]

Template based parsing and progress bars

Working with wifi I have often¬†needed¬†to do a survey of the surroundings, and therefor I loved that windows 7 (maybe even Vista) introduced more advanced netsh with wifi support. There‚Äôs a lot of useful information but it might be nice to have a more graphical overview. The thing is that a text blob like this is not very handy to work with. Some time late¬†last year I heard a guy from the powershell team on the Powerscripting podcast talk about ConvertFrom-String and the new template based parsing. And it occurred to me that you can combine this with a simple […]

Continuous Integration, Continuous Delivery, and PSDeploy

Are you starting to use version control at work? Are you being pestered by fellow PowerShell aficionados to start learning version control? Did you catch the Crash Course in Version Control and pick up some Git and GitHub experience? Shameless plug, sorry : ) Version control is just the start. What if we want to automate testing? To deploy our files, folders, and other artifacts out to production or other environments? Version control alone offers some nice benefits, but without these extra steps, it might introduce some pain points! Developers have a bit of a head start on some […]

What are variables anyway…

Fellow Admins. A quick chat if you’re new to variables. So if you’re like me and don’t know any other programing/scripting language then all this PowerShell¬†stuff is a bit daunting. So to help, this articles is on PowerShell Variables. The thing is that Variables in¬†PowerShell are very important. I’m assuming you know what a cmdlet is? The very basic underlying tools that make powershell work. They are like powershell building blocks or bricks in a¬†PowerShell wall. For example, get-aduser gets a list of all the users in AD and includes a few details like SID, name and distinguished name. So […]

Introduction to Powershell

Hi Guys, I’m going to have a PowerShell ramble on a semi regular basis. What prompts me to write here on is that I love powershell. I makes my job so much better. I’m an IT Pro and work for a large ish world spanning company. I mostly work with windows servers but get to work with other technology too. Like VMware and Citrix for example. The other thing I want to point out is that I’m not a programer. I don’t know VB Script and no one taught me PowerShell. There are many people though that helped me […]

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 […]

Quick Tip: Enable CredSSP trough GPO’s

I thought I share a quick screenshot with you, how I implemented CredSSP trough a GPO in my testlab. This enables me to delegate my credentials to the computer¬†I’m running my Cmdlet’s on. No related posts.

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.