> For the complete documentation index, see [llms.txt](https://docs.plenit.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.plenit.com/docs-en/support/tutorials/windows/how-to-set-up-an-ftp-server-with-powershell.md). Agents can also search and read this documentation through its [MCP server](https://docs.plenit.com/~gitbook/mcp).

# How to install and configure an FTP server in Windows using PowerShell

If you want to know **how to install and configure an FTP server on Windows using PowerShell** join us throughout this brief tutorial where we will do it in simple steps.

This tutorial complements the one we already did through the graphical interface and which we titled [How to install and configure an FTP server on Windows (IIS)](https://jotelulu.com/soporte/tutoriales/como-instalar-y-configurar-un-servidor-ftp-en-windows-iis/){target="\_blank" rel="noopener"}.

**NOTE:** *A hash (#) has been added in front of all the lines for security reasons, since if one of these lines is copied by mistake it will not be executed (the hash is used to comment out code, so it becomes non-executable). To run it, the "#" character must be removed from all lines.*

### **How to install and configure an FTP server on Windows using PowerShell?**

### **Prerequisites or pre-configuration.**

To successfully complete this tutorial and be able to **install and configure an FTP server on Windows using PowerShell** the following will be needed:

* On the one hand, being registered on the Plenit Platform with an organization and being registered in it after doing [Log-in](https://admin.jotelulu.com/){target="\_blank" rel="noopener"}.
* On the other hand, [having subscribed to a Servers subscription](https://jotelulu.com/soporte/tutoriales/como-desplegar-servidor){target="\_blank" rel="noopener"}
* Having a working Windows server within the subscription.

#### **Step 1. Install and configure an FTP server on Windows using PowerShell**

The first thing we will do will be **install the FTP server functionality**, for which you will need to launch the **PowerShell console**, **or PowerShell ISE**. As I have been saying lately, the most desirable thing would be to use ISE (so to speak, Microsoft's IDE), since it allows us to test, see where it fails, etc.

Once in the PowerShell console (or ISE), we must **run the "Install-WindowsFeature" commands** (1).

*# Install-WindowsFeature Web-FTP-Server -IncludeAllSubFeature*

*# Install-WindowsFeature Web-Server -IncludeAllSubFeature -IncludeManagementTools*

*# Import-Module WebAdministration*

Where:

* The command **"Install-WindowsFeature" installs the functionality** of Windows that we pass as a parameter.
* The modifier **"-IncludeAllSubFeature" installs all options** that the Windows feature has.
* The modifier **"-IncludeManagementTools" installs the** **administrative** tools for that functionality.

<figure><img src="https://3894148717-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxksPMyYRDCe4qKkhbpcY%2Fuploads%2FV6mdi29j7pdzIPhlOmND%2F01_Paso-1.-Hacemos-el-despliegue-del-servicio-de-FTP-mediante-PowerShell.png?alt=media&amp;token=e527a446-a704-481b-848f-74ba4e9ec333" alt=""><figcaption></figcaption></figure>

Step 1. We deploy the FTP service using PowerShell

Once this is done, **we continue the installation** by importing the FTP administration module using **the command** **"Import-Module"** (2).

<figure><img src="https://3894148717-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxksPMyYRDCe4qKkhbpcY%2Fuploads%2FI4vwItmjrI3vfRfvq0Cn%2F02_Paso-1.-Importamos-el-modulo-de-administracion-del-FTP-mediante-PowerShell.png?alt=media&amp;token=8e8d8838-a5de-425f-b49f-87245d9c6aeb" alt=""><figcaption></figcaption></figure>

Step 1. We import the FTP administration module using PowerShell

Next, **the new FTP site is configured** to provide service.

This will have a series of characteristics that must be configured, and a command like the following can be run directly:

\*# New-WebFtpSite -Name \ -Port\
-PhysicalPath \*

Where:

* The command **"New-WebFtpSite" deploys the new FTP site.** FTP.
* **"-Name "** describes **the name** that we will give to the FTP site.
* **"-Port "** is a number that indicates **which port** the FTP listens on.
* **"-PhysicalPath "** is the **server path** where the FTP data is located.

This way, it could look like this:

*# New-WebFtpSite -Name 'FTP Site Nacho' -Port '21' -PhysicalPath 'C:\datos\ftproot'*

We could replace it directly there and have the configuration done, but this is a bit of a bodge, so variables are usually used to improve use on future occasions.

To keep everything more organized, **we will create some variables**, as we mentioned, which will be the following:

* **"-Name "** describes the **name that we will give the site** of FTP, with the variable "$Name".
* **"-Port "** is a number that indicates which **port** the FTP listens on, with the variable "$Port".
* **"-PhysicalPath "** is the server path **where the data** of the FTP are located, with the variable "$Root".

Taking this into account, everything is configured and the following commands are executed **the following commands** (3):

*# $Name = 'FTP Site Nacho'*

*# $Root = 'C:\datos\ftproot'*

*# $Port = 21*

*# New-WebFtpSite -Name $Name -Port $Port -PhysicalPath $Root*

<figure><img src="https://3894148717-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxksPMyYRDCe4qKkhbpcY%2Fuploads%2FMT0kHoylZYYyzUFFdy9a%2F03_Paso-1.-Configuramos-el-site-de-FTP-para-el-servicio.png?alt=media&amp;token=0e2686ba-76e2-49d6-977a-d837e951e6fc" alt=""><figcaption></figcaption></figure>

Step 1. We configure the FTP site for the service

At this point, the FTP server itself has already been installed, and what remains is **configure, add users, repositories, securing it**, etc.

At this point, for me, the first thing would be to create a user (and its associated group) in order to test that we can make the connection and not just assume it. That way, if we later secure it by closing ports or configuring certificates, we will be sure that this part was working.

In this case, first we create a group for the users with the ability to connect to the FTP, since it is better to create a group that can be added to later.

To **create the FTP group** (4) we use:

*# $FTPUserGroupName = «FTP Users»*

*# $ADSI = \[ADSI]»WinNT://$env:ComputerName»*

*# $FTPUserGroup = $ADSI.Create(«Group», «$FTPUserGroupName»)*

*# $FTPUserGroup.SetInfo()*

*# $FTPUserGroup.Description = «Members of this group can connect to the FTP»*

*# $FTPUserGroup.SetInfo()*

<figure><img src="https://3894148717-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxksPMyYRDCe4qKkhbpcY%2Fuploads%2Fv8VoKnfuDWXCG2uMVu0q%2F04_Paso-1.-Creamos-el-grupo-de-FTP-para-el-servicio.png?alt=media&amp;token=ccc008de-7548-46f6-917e-44700f5eec38" alt=""><figcaption></figcaption></figure>

Step 1. We create the FTP group for the service

In this case, we will make use of ADSI commands for deploying the group, as always using certain variables to make the configuration easier.

The next thing would be **to create the user with which the FTP connections will be made** (5).

*# $FTPUserName = «ftpnacho»*

*# $FTPPassword = 'Contrasenya123!'*

*# $CreateUserFTPUser = $ADSI.Create(«User», «$FTPUserName»)*<br>

*# $CreateUserFTPUser.SetInfo()*

*# $CreateUserFTPUser.SetPassword(«$FTPPassword»)*

*# $CreateUserFTPUser.SetInfo()*

<figure><img src="https://3894148717-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxksPMyYRDCe4qKkhbpcY%2Fuploads%2FAmdzEPK5Vtw2jxkMgMQd%2F05_Paso-1.-Creamos-un-usuario-para-las-conexiones-de-FTP.png?alt=media&amp;token=41cbbb8d-65fb-4159-86b2-59dbb658f56f" alt=""><figcaption></figcaption></figure>

Step 1. We create a user for FTP connections

Once this is done, it must be **added to the system FTP group** (6), by executing:

*# $UserAccount = New-Object System.Security.Principal.NTAccount(«$FTPUserName»)*

*# $SID = $UserAccount.Translate(\[System.Security.Principal.SecurityIdentifier])*

*# $Group = \[ADSI]»WinNT://$env:ComputerName/$FTPUserGroupName,Group»*

*# $User = \[ADSI]»WinNT://$SID»*

*# $Group.Add($User.Path)*

<figure><img src="https://3894148717-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxksPMyYRDCe4qKkhbpcY%2Fuploads%2FLmpydMDFuIZQze9pdUyv%2F06_Paso-1.-Anadimos-el-usuario-de-FTP-al-grupo-de-FTP-del-sistema.png?alt=media&amp;token=610ef75d-cf61-492e-996a-3ea709fe56f9" alt=""><figcaption></figcaption></figure>

Step 1. We add the FTP user to the system FTP group

At this point you must **enable basic authentication on the FTP site** and then **authorize the Windows group** (7) that contains the FTP user so that it can have access to the FTP site and therefore make use of the service.

To do this, the following commands must be executed:

*\[# $FTPSitePath]\[ = ]\[«IIS:\Sites\\]\[$FTPSiteName]\[«]*

*\[# $BasicAuth]\[ = ]\['ftpServer.security.authentication.basicAuthentication.enabled']*

*\[\[# ]Set-ItemProperty]\[ -Path ]\[$FTPSitePath]\[ -Name ]\[$BasicAuth]\[ -Value ]\[$True]*

*\[# $Param]\[ = @]\[{]*

*\[\[# ]Filter]\[ = ]\[«/system.ftpServer/security/authorization»]*

*\[ \[# ]Value = @]\[{]*

*\[ \[# ]accessType = ]\[«Allow»]*

*\[ \[# ]roles = ]\[«]\[$FTPUserGroupName]\[«]*

*\[ \[# ]permissions = ]\[1]*

*\[\[# ]}]*

*\[ \[# ]PSPath = 'IIS:\\']*

*\[ \[# ]Location = ]\[$FTPSiteName]*

*\[\[# ]}]*

*\[\[# ]Add-WebConfiguration]\[ @]\[param]*

<figure><img src="https://3894148717-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxksPMyYRDCe4qKkhbpcY%2Fuploads%2F4MEve7dn2J4U2YMVE976%2F07_Paso-1.-Configuramos-la-autenticacion-basica-para-nuestro-sitio-de-FTP.png?alt=media&amp;token=d5e0598e-24a1-46d4-869c-163227371aea" alt=""><figcaption></figcaption></figure>

Step 1. We configure basic authentication for our FTP site

The next step is **to change the SSL policy and file permissions (NTFS) in the folder** **FTP server root** (8), that is, where all files uploaded by service users are stored.

To do this, we execute the following commands:

*#* *$SSLPolicy = @(*

*# 'ftpServer.security.ssl.controlChannelPolicy',*

*# 'ftpServer.security.ssl.dataChannelPolicy'*

*# )*

*# Set-ItemProperty -Path $FTPSitePath -Name $SSLPolicy\[0] -Value $false*

*# Set-ItemProperty -Path $FTPSitePath -Name $SSLPolicy\[1] -Value $false*

<figure><img src="https://3894148717-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxksPMyYRDCe4qKkhbpcY%2Fuploads%2F08ktRjcSCYuNk32THkTQ%2F08_Paso-1.-Cambiamos-la-politica-de-SSL-y-los-permisos-de-ficheros-en-la-carpeta-raiz-del-servidor-FTP.png?alt=media&amp;token=3f69ccf9-ec58-4884-ac56-e755f262083e" alt=""><figcaption></figcaption></figure>

Step 1. We change the SSL policy and file permissions in the FTP server root folder

The next step to take is to run the following commands to configure NTFS permissions in the root folder and thus allow users who belong to the FTP group to access and work on this folder.

*# $UserAccount = New-Object System.Security.Principal.NTAccount(«$FTPUserGroupName»)*

*# $AccessRule = \[System.Security.AccessControl.FileSystemAccessRule]::new($UserAccount,*

*# 'ReadAndExecute',*

*# 'ContainerInherit,ObjectInherit',*

*# 'None',*

*# 'Allow'*

*# )*

*# $ACL = Get-Acl -Path $FTPRootDir*

*# $ACL.SetAccessRule($AccessRule)*

*# $ACL | Set-Acl -Path $FTPRootDir*

Finally, for all changes to take effect **the FTP instance must be restarted** (9), to do this the following must be executed:

\# Restart-WebItem «IIS:\Sites\\$Name» -Verbose

<figure><img src="https://3894148717-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxksPMyYRDCe4qKkhbpcY%2Fuploads%2FDY2NRS8TQbJQDuZoTv8l%2F09_Paso-1.-Reiniciamos-el-servicio-de-FTP-desde-consola-de-PowerShell.png?alt=media&amp;token=e141bc95-cb3f-4cea-b4bc-f1b666cc197a" alt=""><figcaption></figcaption></figure>

Step 1. We restart the FTP service from the PowerShell console

With this, the FTP configuration process is complete.

### **Conclusions and next steps:**

Throughout this tutorial we have seen how to carry out the installation and configuration of an FTP server on Windows using PowerShell within one of the Windows servers hosted in Plenit.

If what you have read so far has been interesting, you can delve further into some related services; the following tutorials may interest you:

* [How to deploy a new server in Plenit](https://jotelulu.com/soporte/tutoriales/como-desplegar-servidor){target="\_blank" rel="noopener"}.
* [How to create a site-to-site VPN tunnel in Plenit](https://jotelulu.com/soporte/tutoriales/crear-tunel-vpn-site-to-site){target="\_blank" rel="noopener"}.
* [How to create templates on a server for reuse in Remote Desktop](https://jotelulu.com/soporte/tutoriales/crear-plantillas-servidor-para-reutilizarlas-escritorio-remoto){target="\_blank" rel="noopener"}.
* [How to create a VPC and associate a TIER in Plenit](https://jotelulu.com/soporte/tutoriales/como-crear-vpc-asociar-tier){target="\_blank" rel="noopener"}.

We hope that, with this small guide, you will have no problems configuring your FTP server quickly and functionally, but if you do, do not hesitate to contact us so we can give you a hand.

**Thank you for your trust.**


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.plenit.com/docs-en/support/tutorials/windows/how-to-set-up-an-ftp-server-with-powershell.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
