Before we can connect to a Nano server we need to add it to the trusted hosts list of the server you are connecting from.
Set-Item WSMan:localhostClientTrustedHosts "192.168.1.100"
Then to create a new session to the server
$nano - New-PSSession -ComputerName 192.168.1.100 -Credential (Get-Credential)
Next, to join the Nano server to the Domain we need to use the Offline domain join method to create a blob file. This command should be run on the DC, so Exit-PSSession from the session above if still connected.
djoin.exe /provision /domain testlab.local /machine NanoServer1 /savefile .djoin.blob
Next we need to copy this blob file to the C: on the NanoServer1. We can pass this file right into the session variable we made earlier.
Copy-Item -Path .djoin.blob -DestinationPath C: -Tosession $nano
Next we connect back to the nano server to complete the join.
Enter-PSSession -Session $nano
Next we need to complete the join using the blob file on the NanoServer1.
djoin.exe /requestodj /loadfile C:djoin.blob /windowspath C:windows /localos
Once complete just reboot the nano server – You should then be able to log onto it with the domain administrator credentials.
Its also good practice to remove the IP from the trusted hosts list that we added earlier like this.
Set-Item WSMan:localhostClientTrustedHosts ""
Now that the NanoServer1 is a member of the domain, we can now run a remote powershell session to it via it’s DNS name like this, and if we’re logged in with adminsitrative credentials we dont even need to add the Get-Credential cmdlet.
Enter-PSSession -ComputerName NanoServer1
To see a list of all Package Providers. These are online repositories that PowerShell can download packages from.
To find what packages a particular provider has run
Find-Package -ProviderName NanoServerPackage
where “nanoserverpackage” is the name of the desired package provider.
Next we need to install the package provider top use it.
IF Intsall-Package Provider fails or gives you an error you can run:
NanoServerPackage . NanoServerPackage
Once installed we need to Import the Package Provider, like importing a module but it’s a different command.
Next in this example we want to install the storage package. Using the above commands to find this we should be able to run
Install-Package -Name Microsoft-NanoServer-Storage-Package
A reboot will be required.
Once rebooted we can connect to and manage this Nano server from Server Manager simply by adding it like any other server.