Create a Visual Studio Project for your PowerShell Scripts

Are you eager to take advantage of Visual Studio PowerShell Tools? This video talks about how to create a Visual Studio Solution & Project to help you manage your PowerShell script files. If you’ve already got a set of one-off scripts, that doesn’t necessarily warrant a PowerShell module, but you still want to author, debug, … Read moreCreate a Visual Studio Project for your PowerShell Scripts

PowerShell: Embed binary data in your script

When writing automation scripts or modules, you might find that you frequently reference external binary data.

Binary data? Well, that accounts for all data!” you might say.

Yes, that’s true. But I’m talking about binary data as opposed to files containing simple ASCII or UTF-8 data. Maybe there’s some better terminology to describe that, but hey it works for now. Binary data could include things such as:

  • Word documents
  • Executable (Portable Executable format)
  • Code libraries (DLLs)
  • Registry files
  • etc.

In the case of executables, oftentimes they provide useful functionality that would take many lines of PowerShell code to replicate. Some developers, for better or for worse, elect to use these utilities instead of going through the effort of writing the necessary code to handle the function natively in PowerShell. This creates an additional dependency when porting the PowerShell code, as the author must be sure to include the utility with their code, or otherwise ensure (via documentation, for example) that the target user will already have it available.

Wouldn’t it be nice if you didn’t have to depend on the user having some executable pre-installed, just to get your script to work, though? Unfortunately the little topic of “software licensing” can sometimes prevent redistribution of software that you are not given explicit permission to copy, however there are also many cases where this is allowed (eg. open-source projects). The work-around in cases where redistribution is not allowed, is to either direct the user where to download the software from, or automate it for them.

Read morePowerShell: Embed binary data in your script

Copy Filenames to Clipboard with PowerShell

Have you ever wanted to copy a large amount of data to the Windows clipboard, but haven’t known quite how to do it? How about this scenario: you have a folder full of files, and you want to get a list of the files’ full names / paths. That’s pretty easy to do with a … Read moreCopy Filenames to Clipboard with PowerShell

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 release of my first ever … Read morePowerShell Module: Enable Wake for Devices

AutoIT: Enumerating all Windows

Here is a short script I wrote using AutoIT, which enumerates all of the windows, to the StdOut stream: ConsoleWrite(“Enumerating windows”) $AllWindows = WinList() ConsoleWrite(“Found ” & UBound($AllWindows) & ” windows”) for $i = 0 to UBound($AllWindows) – 1 ConsoleWrite(@lf & “Name: ” & $AllWindows[$i][0]) ConsoleWrite(@lf & “HWND: ” & $AllWindows[$i][1]) next ConsoleWrite(@lf & “Completed … Read moreAutoIT: Enumerating all Windows

Handy Process Management Utilities

Hey guys, I just wanted to share a couple of cool utilities to assist with managing processes. ImageCFG ( ImageCFG is a utility that lets you tweak the CPU affinity of an executable. What does this mean? Well, if you have a multi-core system, or even a hyper-threaded (virtual multi-core) system, you can restrict which … Read moreHandy Process Management Utilities

Deploying Windows 7 RSAT

If you’ve got a large number of Windows 7 machines that you’ve already deployed, but now need to silently deploy the Remote Server Administration Tools (RSAT), you’re in luck. It’s quite simple to do, and Microsoft provides the necessary tools to automate this deployment. The RSAT pack is downloaded as a MSU file, so it … Read moreDeploying Windows 7 RSAT

PowerShell: AD Workstation Cleanup Script version 2.0

Update (2010-08-25): I have posted a newer version of this script. A little while ago, I posted a PowerShell script that detects old machine accounts in Active Directory, and disables or deletes them, based on certain ages (in days). I’ve continued work on this script, such that it now logs information to Excel about actions … Read morePowerShell: AD Workstation Cleanup Script version 2.0