How to Copy a File on a Nano Server with PowerShell. As you know, Nano Server has no communication path except PowerShell Direct. In the previous articles, we explained how to connect to a Nano Server. Now you may ask how can a file be sent to a nano server? Or how to copy the required files to the Nano Server?
From the series of Nano Server tutorials, in this article, we will teach you how to copy a file on a Nano Server with PowerShell.
It may seem at first that uploading a file to a site and downloading it with PowerShell will solve this issue. Yes that’s right. This is a simple and of course Linux way. When connecting to SSH Linux, you will not be able to send the file directly, but in PowerShell it is possible to copy a file from the host to the destination server, which is the nano server.
Copy the file to the Nano Server with PowerShell
First, enter the information needed for the connection or the session in a variable as shown below:
$session = New-PSSession -ComputerName 192.168.0.21 -Credential administrator
In the above command, $session is our variable name and 192.168.0.10 will be the IP address of the Nano Server.
Finally, we have entered the name Administrator as a username.
After entering the above command, enter the following command to copy the file:
Copy-Item C:\VMs\NanoServer\* -Destination c:\files\Nano -recurse -ToSession $session -Verbose
After entering the above command you will copy a file named Michael.txt from C:\VMs\Nanoserver to C:\files\Nano.
Note 1: If you are asked for a password, enter your Nano Server password after entering the above command.
Note 2: The address entered in the nano server that is entered in the Destination section must be pre-created.
You have simply copied the file you want to your nano server.
Also, see:
How to add a Package of Roles to the Nano Server
Dear user, we hope you would enjoy this tutorial, you can ask questions about this training in the comments section, or to solve other problems in the field of Eldernode training, refer to the Ask page section and raise your problem in it as soon as possible. Make time for other users and experts to answer your questions.
Goodluck.