Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Introduction
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.
WARNINGS AND DISCLAIMERS
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:
PowerShell
LetsEncrypt
Additionally, in order to improve security the following components are included:
Another notable difference is that the default shell for the root user has been set to
PowerShell.
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.
Finally, select a hostname for your new Droplet. You may accept the default name or
enter your own:
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.
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:
Output
PowerShell
Copyright (C) 2016 Microsoft Corporation. All rights reserved.
PS /root>
nano Hello.ps1
Save the file and exit by pressing CTRL-X, followed by Y, followed by the ENTER key.
Now, execute the script:
./Hello.ps1
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:
.Net
PowerShell