Tag: Windows

Windows Terminal Background Acrylic Opacity

How to Change the Windows Terminal Background Image

As you may know, Microsoft released a new Windows Terminal, which is currently in preview. However, it has some great new features, and a lot of people are currently trying it out. Now I got a lot of questions about how you can change the background of the Windows Terminal. So I decided to write a quick blog post about how you can configure and customize the Windows Terminal background image. There are multiple ways you can do this. And you can not only change the color or use a background image, but you can also change the opacity, and if it should use the acrylic Windows effect.

Customize the Windows Terminal Background Image

First open the settings of the Windows Terminal app, which will open a JSON file, where the settings are stored.

Windows Terminal Settings

Windows Terminal Settings

This will allow you to customize the settings and colors of the terminal. Every console has a so-called profile, which you can modify. Let’s start with adding a background image.

        {
            "acrylicOpacity" : 0.5,
            "closeOnExit" : true,
            "colorScheme" : "VibrantInk",
            "commandline" : "C:\\Program Files\\PowerShell\\6\\pwsh.exe",
            "cursorColor" : "#FFFFFF",
            "cursorShape" : "bar",
            "fontFace" : "Consolas",
            "fontSize" : 12,
            "guid" : "{574e775e-4f2a-5b96-ac1e-a2962a402336}",
            "historySize" : 9001,
            "icon" : "ms-appx:///ProfileIcons/{574e775e-4f2a-5b96-ac1e-a2962a402336}.png",
            "name" : "PowerShell Core",
            "padding" : "0, 0, 0, 0",
            "snapOnInput" : true,
            "startingDirectory" : "%USERPROFILE%",
            "useAcrylic" : true,
            "backgroundImage": "C:/Users/thoma/OneDrive/Pictures/Me/Thomas Maurer Logos 2016/WindowsTerminal/Black Cloud Robot.png",
            "tabTitle": "PowerShell Core "
        },

With the “backgroundImage” value, you can set a specific image as the background.

"backgroundImage": "C:/Users/thoma/OneDrive/Pictures/Me/Thomas Maurer Logos 2016/WindowsTerminal/Black Cloud Robot.png"

Opacity

You can use the “backgroundImageOpacity” to set the opacity of the for the background image, and this is super helpful when you have a full background image.

Windows Terminal Background Image Opacity

Windows Terminal Background Image Opacity

You can add the following value to configure the opacity.

"backgroundImageOpacity" : 0.2

Acrylic effect

You can also configure the Windows Terminal to use the Acrylic effect in Windows 10 for the background. This will combine the acrylic effect with the background image.

Windows Terminal Background Acrylic Opacity

Windows Terminal Background Acrylic Opacity

Just set the following value to the settings.

"useAcrylic" : true,
"acrylicOpacity" : 0.5

Here is a full config you can have a look at, with all the settings enabled.

Profile

Profile

Let me know if that helps you to set, change, and customize the background image of the Windows Terminal. You can read more about the new Windows Terminal on the official blog. And if you want to know more about how you can run Azure Cloud Shell in the terminal, check out my blog post. If you have questions, let me know in the comments.



Download the new Windows Terminal Preview

How to open Windows Terminal from Command Prompt or Run

This is a really short blog post and more of a reminder than anything else. You might have seen the new Windows Terminal for Windows 10 was just released in the Windows Store as a preview. However, in the last couple of updates to the Windows Terminal app, it got to a state which already makes it my default terminal. The Windows Terminal allows you to run Windows PowerShell, PowerShell Core and even Bash using the Windows Subsystem for Linux (WSL). Especially the integration of the Azure Cloud Shell is a great plus for me. In this blog post, I am just going to show you how you can open the Windows Terminal from command prompt or Run (WIN + R).

To open Windows Terminal from the command line (cmd) or in Windows Run (WIN +R) type:

wt
Open Windows Terminal start wt

Open Windows Terminal start wt

 

If you want to know more about the Azure Cloud Shell integration, read the blog of Pierre Roman (Microsoft Cloud Advocate) on the ITOpsTalk blog.



Docker Desktop WSL 2 Tech Preview

Run Linux Containers with Docker Desktop and WSL 2

Today, Docker launched the first Tech Preview of the Docker Desktop WSL 2. This means you can now use Docker Desktop and the Windows Subsystem for Linux 2 (WSL2) which is using the hypervisor in the background to run Linux containers on Windows 10. With the significant changes to the Windows Subsystem for Linux 2, you can now take advantage of these improvements with your Docker Desktop client.

Docker Desktop WSL 2 is currently in Tech Preview, and it also requires the Windows 10 Insider Preview builds. That means you should only use for not production environments.

WSL 2 introduces a significant architectural change as it is a full Linux kernel built by Microsoft, allowing Linux containers to run natively without emulation. With Docker Desktop WSL 2 Tech Preview, users can access Linux workspaces without having to maintain both Linux and Windows build scripts.

Docker Desktop also leverages the dynamic memory allocation feature in WSL 2 to greatly improve the resource consumption. This means, Docker Desktop only uses the required amount of CPU and memory resources, enabling CPU and memory-intensive tasks such as building a container to run much faster.

You can find more information about the Tech Preview here.

Prerequisites

To run the Docker Desktop WSL 2 Tech Preview, you will need to set up the Windows Subsystem for Linux 2 (WSL 2) first. You can do that using the following guide, or follow these steps:

Install Windows 10 Insider Preview build 18932 or later.

Install the Windows WSL feature and the Windows Virtual Machine Platform feature running the following commands:

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
 
Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform

Download WSL Linux distribution based on Ubuntu 18.04 from the Microsoft Store. You can read more about Linux on Windows 10 here. The distribution needs to be set as the default WSL distro.

Enable Virtual Machine Platform

Enable Virtual Machine Platform

Make sure that the WSL distro is running in WSL 2 mode. You can check the list of distros installed on your Windows 10 machine, with the following PowerShell command:

wsl -l -v

To set the distro to WSL 2, you can run the following command. Change the name of the distro:

wsl --set-version DistroName 2
Install WSL 2

Install WSL 2

To find out more about installing WSL 2, check out the Microsoft Docs page.

How to set up Docker and WSL 2

First, you will need to download the Docker Desktop WSL 2 Tech Preview here. Make sure you already configured all the WSL 2 steps described in the prerequisites, before you install the Docker WSL 2 Tech preview. If you are prompted if you want to use Linux containers or Windows containers during the installation, select Windows containers. If you choose Linux containers, you will have the classic Docker experience with a Hyper-V VM.

Docker Desktop WSL 2 Tech Preview Menu

Docker Desktop WSL 2 Tech Preview Menu

Run the installation wizard, and after a successful installation, the Docker Desktop menu displays the WSL 2 Tech Preview option. You can select WSL 2 Tech Preview from that menu to start and configure the daemon running WSL 2.

Docker Desktop WSL 2 Tech Preview

Docker Desktop WSL 2 Tech Preview

You can switch between the classic daemon or the Windows Subsystem for Linux 2 with the following commands:

# Switch to classic deamon
 
docker context use default
 
# Switch to WSL 2
 
docker context use wsl
Linux Container on Windows 10

Linux Containers on Windows 10

You can now also do crazy things like run SQL Server on Linux in a Docker container on Windows 10.

SQL Server on Linux Docker Container Windows 10 WSL 2

SQL Server on Linux Docker Container Windows 10 WSL 2

I hope this gives you a good overview of how you will be able to run Linux containers on Windows in the future. Again this is still a Tech Preview, and we might see many changes to that feature. If you want to know more, read the full blog post on the Docker page. Also, check out the current Linux Container on Windows documentation. If you any questions, feel free to leave a comment.




Thomas Maurer Speaking at Experts Live Europe

Speaking at Experts Live Europe 2019 in Prague

Today, I am proud to announce that I will be speaking at Experts Live Europe 2019 in Prague on November 20 – 22, 2019. This is a great honor, and it will be my 7th Experts Live Europe event I am speaking at, all the way back to the first event, when it still was called System Center Universe Europe. I have presented several sessions at each event previously hosted in Bern, Basel, Berlin, and Prague. This will be the second time Experts Live Europe will be hosted in the beautiful city of Prague, Czech Republic. I am looking forward to speaking at this Microsoft community event again. The conference has a strong focus on Microsoft Cloud, Datacenter, Security, and Modern Workplace topics and brings together the community from all over the world.

This year the conference will be three days again, with a pre-conference day including a couple of different pre-conference deep dives, as well as two main conference days with over 70 breakout sessions in 6 parallel tracks. This year the conference will have not only over 40 top expert speakers but also a vast Microsoft presence. You will not just find Microsoft Cloud Advocates and Program Managers, but people from all across the organization. Guess what, this is a perfect time to connect and network with us, but also with other members of the Microsoft community.

Another big highlight for me this year is the track specifically focusing on Windows Server and System Center, presented by Cloud Advocates, Program Managers, and Microsoft MVPs.

My sessions at Experts Live Europe 2019

I am happy that I will be speaking at Experts Live Europe 2019:

Windows Server 2019 - The Next Generation of Software-Defined Datacenter

Join this session for the best of Windows Server 2019, about the new innovation and improvements of Windows Server and Windows Admin Center. Learn how Microsoft enhances the SDDC feature like Hyper-V, Storage, and Networking and get the most out of the new Azure Hybrid Cloud Integration and Container features. You’ll get an overview of the new, exciting improvements that are in Windows Server and how they’ll improve your day-to-day job. In this presentation Thomas Maurer (Microsoft MVP) will guide you through the highly anticipated innovations in Windows Server 2019 and the Semi-Annual Channel including: ○ Windows Server Containers ○ Azure Integration ○ Hyper-V features ○ Storage ○ Networking ○ Security ○ Windows Admin Center And more!

If you want to know more about the event and register, check out the Experts Live Europe website. I hope to see you in Prague!



PowerShell 7 Installer

How to Install and Update PowerShell 7

Currently, you can install the cross-platform version PowerShell Core 6 on Linux, macOS, and Windows. Early April the PowerShell team announced the next release called PowerShell 7. PowerShell 7 is built on .NET Core 3 and brings back many APIs required by modules built on .NET Framework so that they work with .NET Core runtime. While PowerShell Core 6 was focusing on bringing cross-platform compatibility, PowerShell 7 will focus on making it a viable replacement for Windows PowerShell 5.1 and bringing near parity with Windows PowerShell. Here is how you can install and update PowerShell 7 (preview) on Windows and Linux using a simple one-liner.

If you want to know more about the roadmap, check out Steves blog post.

One great example of how cross-platform PowerShell can work, check out my blog post: How to set up PowerShell SSH Remoting.

Install PowerShell 7 (Preview)

As mentioned PowerShell 7 is currently in preview. You can download and install it manually from GitHub. However, the easiest way to install it is to use the following one-liners created by Steve Lee (Microsoft Principal Software Engineer Manager in the PowerShell Team). You can also use the same one-liners with different parameters to install the current GA version of PowerShell 6.

If you are installing the PowerShell 7 Preview, this will be a side by side installation with PowerShell 6. You can use the pwsh-preview command to run version 7.

One-liner to install or update PowerShell 7 on Windows 10

Install and Update PowerShell 7

You can use this single command in Windows PowerShell to install PowerShell 7. The difference between the installation of version 6 versus version 7 is the -Preview flag.

iex "& { $(irm https://aka.ms/install-powershell.ps1) } -UseMSI -Preview"

There are additional switches to, for example, install daily builds of the latest PowerShell previews.

-Destination
The destination path to install PowerShell Core to.

-Daily
Install PowerShell Core from the daily build.
Note that the ‘PackageManagement’ module is required to install a daily package.

-Preview
Install the latest preview, which is currently version 7. This will

-UseMSI
Use the MSI installer.

-Quiet
The quiet command for the MSI installer.

-DoNotOverwrite
Do not overwrite the destination folder if it already exists.

-AddToPath
On Windows, add the absolute destination path to the ‘User’ scope environment variable ‘Path’;
On Linux, make the symlink ‘/usr/bin/pwsh’ points to “$Destination/pwsh”;
On MacOS, make the symlink ‘/usr/local/bin/pwsh’ points to “$Destination/pwsh”.

One-liner to install or update PowerShell 7 on Linux

Install PowerShell 7 on Linux

You can use this as a single command to install PowerShell 7 on Linux

wget https://aka.ms/install-powershell.sh; sudo bash install-powershell.sh -preview; rm install-powershell.sh

Depending on your distro you are using, this will register Microsoft’s pkg repos and install that package (deb or rpm).

You can also use the following switches:

-includeide
Installs VSCode and VSCode PowerShell extension (only relevant to machines with a desktop environment)

-interactivetesting
Do a quick launch test of VSCode (only applicable when used with -includeide)

-skip-sudo-check
Use sudo without verifying its availability (hard to accurately do on some distros)

-preview
Installs the latest preview release of PowerShell side-by-side with any existing production releases

To currently run the PowerShell Preview, you can run the following command:

pwsh-preview

After Installing

After you have installed PowerShell 7, also make sure to update PowerShellGet and the PackageManagement module.

Remember PowerShell 7 is still currently in preview, if you have any questions, please let me know in the comments.



Ubuntu VM on Windows 10

How to create an Ubuntu VM on Windows 10

Windows 10 is not just a modern desktop operating system, and it also has some great IT Pro and Developer related features build in. One of them is client Hyper-V. This is the same hypervisor which powers virtualization in Windows Server and the Microsoft Azure datacenters. With Hyper-V, you can create virtual machines running on Windows 10, without the need for third-party software. You can not just run Windows virtual machines, and you can also run Linux virtual machines. In this blog post, I am going to show you how you can create an Ubuntu VM on Windows 10 using Hyper-V.

If you want to know more about Hyper-V on Windows 10, check out the Microsoft Docs.

Install Hyper-V

First, you will need to install Hyper-V on your Windows 10 computer. Hyper-V on Windows 10 has the following requirements:

  • Windows 10 Enterprise, Professional, or Education (Home does not have the Hyper-V feature included)
  • 64-bit Processor with Second Level Address Translation (SLAT)
  • CPU support for VM Monitor Mode Extension (VT-c on Intel CPU’s)
  • Minimum of 4 GB memory

The easiest way to enable Hyper-V on Windows 10 is to run the following PowerShell command as an administrator:

Enable-WindowsOptionalFeature -Online -FeatureName:Microsoft-Hyper-V -All

After you have installed Hyper-V, you need to restart your computer.

Create an Ubuntu virtual machine on Windows 10

To create an Ubuntu virtual machine on Windows 10 Hyper-V, you could download the Ubuntu ISO file and install it like any operating system. However, there is a much easier way, using the Hyper-V Quick Create feature. In the Hyper-V VM Gallery, you will find not just two Windows 10 virtual machines; you will also currently find Ubuntu 18.04 LTS and Ubuntu 19.04. These are prepared Hyper-V virtual machines images, ready for you to download and install.

Ubuntu Hyper-V VM Images

Select the Ubuntu version you want to install and click on Create Virtual Machine. This will start downloading the virtual machine image.

Downloading Ubuntu Hyper-V VM Image

After the image is downloaded, you can either connect to the virtual machine and start it, or you can first modify the virtual machine settings.

Ubuntu 18.04 LTS Hyper-V VM

Optional: If you click on Edit settings, you will be able to configure the virtual machine hardware settings like vCPU or vRAM. You can also enable Secure Boot. If you enable Secure Boot for a Linux virtual machine, make sure you change the Secure Boot template to Microsoft UEFI Certificate Authority.

Ubuntu Hyper-V UEFI Secure Boot Settings

You can now start the Ubuntu VM.

Start Ubuntu hyper-V VM

 

This will boot you in the Ubuntu installation, where you can set up your Ubuntu operating system.

Install Ubuntu VM

All the specific Hyper-V drivers for Ubuntu, are already included in the image. This allows you to use features like Hyper-V Enhanced Session Mode, which enables you also to use copy-paste, and others.

Ubuntu VM on Windows 10

I hope this gives you a step-by-step guide, how you can create an Ubuntu VM on Windows 10 using Hyper-V. If you have any questions, please let me know in the comments.