If you have ever tried using Invoke-WebRequest to get a webpage using SSL, you will most likely have seen the following error message:
Invoke-WebRequest : The request was aborted: Could not create SSL/TLS secure channel.
The simple “fix” for this problem is to tell PowerShell to use TLS 1.2 instead of the default 1.0:
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Invoke-WebRequest -Uri "https://some.site.com"
The built-in commands to convert to and from JSON is some (of many) great reasons why PowerShell is such a joy to use. In this short blog post I’m going to write about using line breaks in strings together with ConvertTo-Json. (more…)
When working with large data sets, being able to effectively filter the data is essential. A common exercise where you might need filtering on date is when reading logs, and in this blog post I will show you how you can perform the typical “get all logs from the last x days” and “get all logs between day x and day y” scenarios. (more…)
I’m one of those that always preferred to use the alias ls instead of dir for Get-ChildItem. In the beginning I mixed them up, but when I started using Linux more and more I liked that I could use the same command for the same thing in both PowerShell and bash.
Enter PowerShell 6, available to run on Linux and suddenly ls is not the same as ls anymore! (more…)
If you have ever customized your PowerShell prompt you have probably had a need (or wish) for a function to “intelligently” shortening the current path. I have written a bunch of functions for this and decided to expand on my earlier versions and release it to the PowerShell Gallery. (more…)
Most of you have probably used the PowerShell Package Management cmdlets to download modules from the PowerShell Gallery. Some may even have used it to download software from Chocolatey. In this blog post I’m going to show you how to configure it to be able to download packages from NuGet. (more…)
I recently had a need to retrieve SSL certificate information from a group of servers, running a mix of both Linux and Windows, and I didn’t really want to get the information manually.
When doing automated deployments to Azure, I found that I was missing a single approach for authentication when used both in a release pipeline, and when doing ad hoc testing during development.
I needed something that let me use an Azure Service Principal for automated processes, as well as using my private credentials for other usages.
After many iterations, I think I have something that is worthwhile sharing with others, in the form of simple templates that gives you a kick-start to any Azure project! (more…)
I recently had a need of tagging a large number of resources in Azure, and found it difficult to do this easily. So naturally I ended up creating a helper function to do the job for me. (more…)
Monitoring AWS infrastructure using CloudWatch is mostly a case of just enabling it for the resources you want monitored. You get automatically selected metrics available in CloudWatch, ready for your dashboard. For some reason though, for EC2 instances you do not get any memory (or disk) metrics. I guess this is a shortcoming Amazon have been asked about a lot, because they have made scripts available that you can run on the instance that will send memory and disk data to CloudWatch. (more…)