Quick tip: Invoke-WebRequest and SSL/TLS

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"

Quick tip: Seamlessly switch between different prompts

Most users are probably happy with the default PowerShell prompt. But there are a handful of people that are not satisfied with any product unless they have had a chance to customize it to their needs. Luckily PowerShell supports defining your own prompt quite easily. Then there are another few that for some reason likes to have multiple prompts that they alternate between. Perhaps they have one for home, one for work and another one when they are presenting at usergroups and conferences. (more…)

Quick tip: Fix those line endings

In dealing with data transferred between different operating systems, we often come across the irritating phenomenon of, what might appear as, a file without any spaces in them. This is of course because of different end of line (EOL) characters, and I’m going to show you a quick and easy way of using PowerShell to “fix” these for Windows. (more…)