PowerShell

How To Fix Slow DNS Response and Page Loading with Hyper-V Default Switch

How To Fix Slow DNS Response and Page Loading with Hyper-V Default Switch

In my move away from VMware workstation I’ve been using Hyper-V more and more for virtual machines but I’ve come across a problem only recently. DNS resolution and internet browsing is noticeably slower with many pages not being able to be viewed at all. So after much frustration I decided to tackle this problem today and I found something unexpected. Along with the new Fall Creators Update released at the tail end of 2017 is a new Hyper-V NAT switch called Hyper-V (Default Switch).
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.
Local Or Remote Disk Clean With PowerShell

Local Or Remote Disk Clean With PowerShell

I came across an interesting script on Reddit /r/PowerShell recently. It was an answer to a request for a remote disk clean script that could run across a network. Looking at the code I decided the script could do with a little tidy up and rewrite. If you look at the original code you will find it is environment specific. Some of it has poor design and does not inspire confidence:
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.