Start FTP Website from powershell 4

1

Trying to automate ftp site manipulation on IIS7.5, through powershell, but I can't start the ftp site. Everything else, so far, I succeeded.

PS IIS:\Sites> Get-ChildItem | Where {$_.Name -eq "FtpData"}

Name             ID   State      Physical Path                  Bindings
----             --   -----      -------------                  --------
FtpData          3    Stopped    D:\Services\_Empty             ftp *:80:



PS IIS:\Sites> Start-WebSite -Name "FtpData"
Start-WebSite : The object identifier does not represent a valid object. (Exception from HRESULT: 0x800710D8)
At line:1 char:1
+ Start-WebSite -Name "FtpData"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Start-Website], COMException
    + FullyQualifiedErrorId : InvalidOperation,Microsoft.IIs.PowerShell.Provider.StartWebsiteCommand

This issue is address in technet "Starting / Stoping an FTP site using PowerShell... IIS 7.5 on 2008R2" but is has three years old.

Using the appcmd has the same issue:

C:\Users\myself>c:\Windows\system32\inetsrv\appcmd start site FtpData
ERROR ( hresult:800710d8, message:Command execution failed.
The object identifier does not represent a valid object.
 )

This article FTP on IIS 7 on Server Core indicates to start it from the UI Console, but that means it can't be automated.

Has any one got a solution to this?

powershell
iis-7.5
asked on Stack Overflow Apr 11, 2014 by saamorim

2 Answers

1

Stumbled upon this through Powershell autocomplete and turned out working on Server 2012 R2:

    $ftpSite = IIS:\Sites\FtpData
    $ftpSite.ftpServer.Start()
answered on Stack Overflow Apr 19, 2014 by Dam
0

The $ftpSite... did not work for me. I also found the below to be neater.

To Start:

 (get-Website -Name "myftpsite").ftpserver.start() 

To Stop:

 (get-Website -Name "myftpsite").ftpserver.stop()

Source: https://peter.hahndorf.eu/blog/iisftp.html (Forever Breathes The Lonely Word - Peter Hahndorf on software IIS - Managing FTP sites with PowerShell)

answered on Stack Overflow Jun 14, 2018 by Anthony Horne

User contributions licensed under CC BY-SA 3.0