PowerShell: Disable CapsLock

Here’s a quick code snippet that shows how to disable CapsLock using PowerShell, combined with some embedded C# and .NET Interop (aka. P/Invoke.NET) code. Credit goes to “BobS00327” for the C# code necessary to handle this. function Set-CapsLock([switch]$Disable = $true) { $CapsCtrl = @" using System; using System.Runtime.InteropServices; using System.Windows.Forms; …

Continue reading

PowerGUI: Save Time, Customize Snippets

Introduction Quest’s PowerGUI Integrated Development Environment (IDE) offers the ability to insert code snippets, similar to Microsoft Visual Studio. This saves a lot of typing, and gives you the general framework for whichever PowerShell construct you’re trying to us, for which you only need to fill in the specifics. These …

Continue reading

PowerShell: ConfigMgr WMI Provider (feat. Lazy Properties)

What are Lazy Properties? So if you’re a script writer, and you also use System Center Configuration Manager 2007 (ConfigMgr), you may have run into a concept called Lazy Properties. Lazy properties are certain (not all) properties on certain (not all) WMI classes, within the ConfigMgr provider namespace, that are …

Continue reading

PowerShell Module: Enable Wake for Devices

So in my last post, I shared a PowerShell script that enables you to enable devices to wake up computers. This script relies solely on a WMI interface, but despite the remote nature of WMI, I had provided no method of entering a remote computer name. That changes with the …

Continue reading

PowerShell: Enable wakeup for devices

Introduction Sometimes, if you allow your computers to go to sleep regularly, you may want to ensure that they can be easily woken using their keyboards, mice, or other peripherals. End users can get confused if they are only able to wake their computer by pressing the power button; sometimes …

Continue reading

PowerShell: Removing a list of computers from Active Directory

@Kid_Zer0 on Twitter recently asked the following question: “Need to delete a list of computers from AD – anyone know how to do this in #PowerShell or #VBScript (List is from a file)” I’ve previously written several versions of an Active Directory cleanup script, but if you’re not seeking something …

Continue reading

PowerShell: Finding Currently Loaded DLLs

I was just browsing through the root\cimv2 WMI namespace this morning, using SAPIEN’s free WMI Explorer tool, when I happened across a WMI class called CIM_ProcessExecutable. In fact, what I was doing in a bit more detail, was going through the CIM_* classes, with the Instances tab selected, so I …

Continue reading

PowerShell: Enable / Disable Wake-on-LAN (in ConfigMgr)

Hello from Houston, Texas everyone! Today I’ve got a PowerShell script that was specially developed for my consulting engagements going forward. When implementing 1E WakeUp at a customer, who is integrating it with ConfigMgr (to wake up machines using Software Distribution and Software Updates assignments), I have found that occasionally, …

Continue reading

Exporting ConfigMgr Task Sequences

This article will briefly discuss how to export a ConfigMgr OSD task sequence. The SMS_TaskSequencePackage class has a lazy property named Sequence which contains the XML for the task sequence. Because this is a lazy property, we must obtain a reference to each WMI instance using its direct path, before …

Continue reading