PowerShell

Extract A File Icon Using PowerShell and .NET

Extract A File Icon Using PowerShell and .NET

I’ve been resisting buying a Stream Deck for a while now but finally succumbed to temptation and it arrived today. Setting it up is fairly easy but associating a program with a button does not extract the icon from the executable. So I looked for a way to extract the icon myself. And of course I looked to use PowerShell. I knew there was a Drawing namespace in .NET so I browsed the latest .
Creating Enums In PowerShell

Creating Enums In PowerShell

In a previous blog post I talked about working with enums in PowerShell and how useful they are. Would they not be even more useful if we could create and use our own enums? Yes, yes they would. And if you read below you’ll find out how. You’ve been able to create enums in PowerShell since v1.0. But since the introduction of PowerShell version 5 there are now two ways:
Working With Enums In PowerShell

Working With Enums In PowerShell

Enums are not a commonly used data type in PowerShell but after using them to force the TLS version that PowerShell would use in the previous blog post, I was reminded of how simple and useful this little used data type really is. Although they have been usable since PowerShell 1.0, they got some love in version 5. What Is An Enum? An enumerated type (called an enum for short) defines a set of values and restricts it’s use to those values.
Force PowerShell to use TLS 1.2

Force PowerShell to use TLS 1.2

Recently I’ve begun to move the Chocolatey packages I maintain from manual to automatic updating. Going through each package I came across an issue with Yubico Authenticator while retrieving the downloads page using Invoke-WebRequest This caught me by surprise as I was retrieving other Yubico website pages, such as developers.yubico.com, without issue. I decided to look at the SSL / TLS protocols for the pages using SSL Labs SSL online test and found the following:
Reset WSUS Settings And Use Windows Update

Reset WSUS Settings And Use Windows Update

I was recently reminded that my WSUS server is no longer available on the network. The Windows 8.1 tablet couldn’t find it and as a result couldn’t update to Windows 10. This is how I reset WSUS settings on the tablet and used Windows Update for the future. Removing WSUS settings is easy. You have two options to do so using the Registry or using PowerShell. They both achieve the same thing.
Rename Files with PowerShell

Rename Files with PowerShell

If you’re used to renaming files at the command prompt you might be surprised to discover that to rename files with PowerShell requires a few more keystrokes. To rename files with PowerShell we need to use a scriptblock to construct the new filename: # Change the extensions from .bak to .backup Get-Item '*.bak' | Rename-Item -Newname { $_.name -replace '.bak','.backup' } This will change each file with the extension bak to the extension backup.
Convert VMware VMDK to Hyper-V VHDX

Convert VMware VMDK to Hyper-V VHDX

There are tools such as Solarwinds V2V that convert from one virtual disk format to another. However I wanted to see if it was possible to convert disk formats with PowerShell. You can do it. With Microsoft tools. But unfortunately not directly. The Microsoft Virtual Machine Converter is Microsoft’s version of the VMware Virtual Machine Converter. However Microsoft’s tool will not allow you to convert VMware Workstation virtual machines directly and instead forces you to convert the hard disk in PowerShell and setup the new virtual machine in Hyper-V directly and attach the newly converted virtual hard disk.
Block Windows 10 Upgrade

Block Windows 10 Upgrade

In an earlier post I wrote about how to force the Windows 10 upgrade through Windows Update. In this post I will show you how to block Windows 10 upgrade from Windows Update. The confusion around Windows 10 upgrade blocking. There seems to be some confusion around how to block the Windows 10 upgrade: We should uninstall KB3035583 and all will be well - doesn’t seem to work as the update is reinstalled again.
Force The Windows 10 Upgrade With Windows Update

Force The Windows 10 Upgrade With Windows Update

In an earlier post I outlined how to use the Windows 10 Media Creation Tool to download Windows 10. While handy for doing a multiple installs or a clean install, what if you just want to apply the Windows 10 upgrade through Windows Update? In this post I will outline what you need to do to use Windows Update to download the Windows 10 upgrade and apply it to your computer alone.