We hope you find this tutorial helpful. In addition to guides like this one, we provide simple cloud infrastructure for developers. Learn more →

How To Use the .Net Core With PowerShell One-Click Image

PostedOctober 13, 2016 1k views One-Click Install Apps Ubuntu 16.04


Microsoft's .Net Core and PowerShell are technologies that are familiar to developers working in Windows environments. Recently, Microsoft made these available for Linux.

.Net is the go-to platform for Windows Developers. It is used to write desktop, command-line, mobile, and web applications using a standard set of libraries and frameworks called .Net Core. PowerShell is a task automation language originally written to manage Windows systems that leverages elements of .Net to write more powerful scripts. While applications are generally written in .Net, PowerShell is a scripting language.

DigitalOcean provides a One-click image for .Net Core and PowerShell on Ubuntu 16.04 so you can get started using these technologies quickly. In this tutorial, you'll create a new Droplet that runs PowerShell, and you'll test it out by creating and running a small PowerShell script.

Preview Status

Both .Net Core and PowerShell for Linux are listed as being in preview at the time this article was written. As a result, the .Net/PowerShell image is targeted at developers who need a Linux environment that runs .Net Core or PowerShell for experimentation, development, and testing.


  • These images are considered PREVIEW IMAGES.
  • Production use of this image is strongly discouraged.
  • DigitalOcean support is unable to offer support for the .Net Core or PowerShell components.
  • DigitalOcean may elect to remove this image with a 14-day deprecation notice to active users via email.

Included Components

In addition to the features available on a regular Ubuntu 16.04 Droplet, the .Net/PowerShell image includes:

  • The .Net Core
  • PowerShell
  • LetsEncrypt

Additionally, in order to improve security the following components are included:

  • iptables: A standard firewall included in most Linux distributions by default.
  • ufw: A front-end to iptables that allows for easy management of a firewall.

Another notable difference is that the default shell for the root user has been set to PowerShell.

Create Your .Net/PowerShell Droplet

The easiest way to create a Droplet with support for .Net Core and PowerShell is through the DigitalOcean user interface. Log into your account and coose Create Droplet.

In the Choose an image section, click the One-click apps tab and select the .Net Core w/ PowerShell on Ubuntu 16.04 image.

The .Net Core with PowerShell on Ubuntu 16.04 image

Next, select a size for your Droplet

The Droplet size selection interface

Then select your desired region:

The region selection interface

Next, select any additional settings you'd like, such as private networking, IPv6 support, or backups.

Then select which SSH keys, if any, you want to use to access the Droplet. When you're ready, click the Create Droplet button.

Selecting keys to associate with your Droplet

Finally, select a hostname for your new Droplet. You may accept the default name or enter your own:

The Hostname field

Once your Droplet has been created, you can access it by connecting to your Droplet as root via SSH, using the IP address displayed next to your new Droplet.

Access the Droplet Via SSH

Now that your new Droplet is created, you can log in using SSH.

Open a terminal on your computer and execute this command, using the IP address associated with your Droplet:

ssh root@your_server_ip

If you haven't used SSH before, or are using PuTTY on Windows, you may want to refer to this tutorial for more details: How To Connect To Your Droplet with SSH.

If you are prompted for a password, enter the password that was emailed to you when the Droplet was created and follow the on-screen prompts to replace your temporary password. Alternatively, if you set up the Droplet with SSH keys, the keys will be used for authentication instead.

Once you log in, you'll be presented with the PowerShell prompt:

PowerShell Copyright (C) 2016 Microsoft Corporation. All rights reserved. PS /root>

Note: PowerShell includes command-line completion features. As a result, you may experience some flickering as you type when connected via SSH. This is caused by PowerShell refreshing the screen and is a known issue.

Now you can test out the environment.

Run a PowerShell Script

You now have a Linux environment that supports running PowerShell scripts and some .Net applications, Let's write a quick PowerShell script and make sure we can run it.

Create a new file called Hello.ps1 with the nano text editor:

  • nano Hello.ps1

Add the following code to the file:

# A simple "Hello World" program in PowerShell

Write-Host 'Hello World!'
Write-Host "Good-bye World! `n"

Save the file and exit by pressing CTRL-X, followed by Y, followed by the ENTER key.

Now, execute the script:

  • ./Hello.ps1

You'll see the following output in your terminal:

Hello World! Good-bye World!

While that was a fairly simple script, it demonstrates that your Droplet can run PowerShell scripts successfully.

Warning: We're just testing things out in this tutorial. But if you were doing this for a production environment, you should follow our Initial Server Setup guide to give sudo privileges to a non-root user, lock down the root login, and take other steps to make your VPS ready for production.

Next Steps

Now that you have an environment configured for .Net and PowerShell, you can continue experimenting with projects of your own. Start with the following tutorials from Microsoft:


Creative Commons License