Getting PowerShell Core to run on Linux was easy enough. As I’m running Kubuntu 18.10 it’s a simple case of using snapd.
However, I didn’t expect running PowerShell Core on Linux to be problem free. And it wasn’t. After installing my own PsTodoTxt module from the PowerShell Gallery, PowerShell couldn’t find it.
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).
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 .
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:
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.
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:
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.
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.
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.
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: