Written by 5:30 pm Microsoft, Microsoft Azure, PowerShell, Virtualization, Windows, Windows Server

How to Remote Manage your Nano Server using PowerShell

PowerShell Direct Invoke-Command

In a blog post some days ago I wrote how you can create your Nano Server Image and boot it inside a Virtual Machine. If you are familiar with Nano Server you know that Nano Server is a headless server so you can’t really login to this server. The only thing you can login is to the Nano Server Recovery Console. In the Nano Server Recovery console you can only view some information about the server such as Name or IP Address, restart the server and reset the network configuration. You don’t get any access to a shell or file system.

Nano Server Recovery Console

If you want to manage your Nano Server right now you can use the old MMC tools for Remote Management or PowerShell. PowerShell will be the key here to do simple management tasks. For this you can use PowerShell Remoting or if you run your Nano Server in a Virtual Machine you can also use PowerShell Direct.

For PowerShell Remoting you first have to configure your source system, if you haven’t already done this. (Some parts are maybe not needed if your local machine is in the same Active Directory Domain as your Nano Server).

you may need to start the WinRM service on your desktop to enable remote connections. From the PS console type the following command:

# Start the WinRM Service
net start WinRM

From the PS console, type the following, substituting servername or IP with the appropriate value (using your machine-name is the easiest to use, but if your device is not uniquely named on your network, try the IP address):

Set-Item WSMan:\localhost\Client\TrustedHosts -Value "servername or IP"

If you want to connect multiple devices, you can use comma and quotation marks to separate each devices.

Set-Item WSMan:\localhost\Client\TrustedHosts -Value "servername or IP, servername or IP"

You can also set it to allow it to connect to every server using the following command:

Set-Item WSMan:\localhost\Client\TrustedHosts -Value "*"

Now you can start a session with your Nano Server. From you administrator PS console, type:

Enter-PSSession -ComputerName "servername or IP" -Credential servername\Administrator

As mentioned before, if you have installed your Nano Server in a Virtual Machine running on a Hyper-V host you can use PowerShell Direct to directly connect from your local Hyper-V host to your Nano Server VM.

Enter-PSSession -VMName "VMName" -Credential servername\Administrator

Tags: , , , , , , , , , Last modified: June 26, 2019
Close Search Window