Who is Running Your PowerShell Script?

I’ve often talked about the benefit of including Verbose output in your PowerShell scripts and functions from the very beginning. This is especially helpful when someone else is running your command but encounters a problem. You can have them start a transcript, run your command with –Verbose, close the transcript and send it to you. if you’ve written informative Verbose messaging you should be able to figure out the problem. Part of the information might include metadata about the person running the command and their environment. To simply things, I’ve created an easy to use function called Get-PSWho.

Continue reading

Are You My Type?

I am always stressing that PowerShell is all about the objects. If you keep this in mind, PowerShell is pretty easy to use. Get a bunch of things, and select the details that you want to see or work with. Out of the box PowerShell gives you some very rich objects to work with from simple files to Active Directory users. What I like even more is that you can create your own properties “on-the-fly” to meet your needs. It is almost like magic. You can create new properties practically out of thin air. But sometimes even this process can get a bit tedious or overwhelming. Let me offer some solutions.

Continue reading

Friday Fun: Listing WMI Namespaces

Welcome once again to the end of the week.  Hopefully you spent some time in PowerShell. If not, perhaps this tidbit will be intriguing enough to give it a try. I always try to put the “fun” in function and today I have one that will enumerate all the WMI namespaces, but using Get-CimInstance, or the “modern” way to work with WMI. You probably know about the root\Cimv2 namespace but there are many others and if you explore you might find some other namespaces and classes that are useful.

Continue reading

Are You My Nano?

I’ve been diving a bit deeper into the Nano waters now that Windows Server 2016 is out the door. As I deployed a few servers I realized there was a potential long-term management issue. During the technical preview, Nano installations were recognized by their Tuva designation. But now, a Nano server is just another Windows Server 2016 installation. So how can I tell if a server is a Nano installation? Here’s the solution I came up with.

Continue reading

Get Antivirus Product Status with PowerShell

I expect that most of you with enterprise wide antivirus installations probably have vendor tools for managing all of your clients. If so, don’t go away just yet. Even though I’m going to demonstrate how to get antivirus product status with PowerShell, the scripting techniques might still be useful. Or you might learn a bit more about WMI and the CIM cmdlets.  Let me start with a simple command to get antivirus information from your local computer, assuming you are running PowerShell 3.0 or later.

Continue reading