locked
Starting / Stoping an FTP site using PowerShell... IIS 7.5 on 2008R2 RRS feed

  • Question

  • Hi, so I want to automate / build functions with PowerShell to interact with IIS 7.5! I done some reading and come to the conclusion (if I am not mistaken) that I should be able to administer / script the FTP server with the cmdlets that are contained in the WebAdministration module. So, for example if I want to stop() an already existing FTP site <MyCustomFtpSite> I run the following code:

    Stop-WebSite -Name MyCustomFtpSite

    Generates error: (Stop-Website : The object identifier does not represent a valid object) and I can ensure that the site is there....

    If I do another way of binding to the site, as below:

    [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.Web.Administration") | Out-Null
    $iis = New-Object Microsoft.Web.Administration.ServerManager
    $iisTargetSite = $iis.sites["MyCustomFtpSite"]
    $iisTargetSite.Stop()

    Generates the following error:
    Exception calling "Stop" with "0" argument(s): "The object identifier does not represent a valid object. (Exception fro
    m HRESULT: 0x800710D8)"

    And finally, should be able to do it the following way as well (according to me, but hey, who knows...):

    $objDesiredWebSite = Get-WebSite | Where {$_.Name -eq "MyCustomFtpSite"}
    $objDesiredWebSite.Stop()

    Generates error: The object identifier does not represent a valid object. (Exception from HRESULT: 0x800710D8)

    To be honest, what am I missing? I dont understand... previously I got an error saying that the "WAS" service could not be detected. So I installed additional components of the IIS server which lead me to the next error msg shown above... I dont get it! I know I am slow, but altering configuration with PowerShell is normally a lot easier than this....

    I would be much happier if anyone could point in the right direction on what I am missing or what I need to add! I sure hope it is something silly....


    br4tt3
    Sunday, November 21, 2010 8:44 PM

Answers

  • Hi,

    It’s a known issue. The cuase is that FTP sites are different from HTTP sites and some of the tools look for the HTTP binding information in order to work (‘pure’ FTP sites would not have the http binding). Product team is aware of this issue. Hope them will resolve it soon. If there is any update, I will post it here.

    Thanks.

     


    This posting is provided "AS IS" with no warranties, and confers no rights. Please remember to click "Mark as Answer" on the post that helps you, and to click "Unmark as Answer" if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
    • Marked as answer by br4tt3 Thursday, December 2, 2010 1:22 PM
    Wednesday, November 24, 2010 7:34 AM

All replies

  • Hi,

    Thing is, if I do the same code examples against a website instead of a FTP site, it works.... I can then stop / start etc... but does not really help me! Does any one know if the web cmdlets support the ftp component as well?

    Cause, I can see that there is one cmdlet for creating a new ftp site and and a separate cmdlet for creating webbies! However, removing a site, u can use the same cmdlet (Remove-WebSite) for removing webbies as well as ftp sites! So, does this behaviour comply to all aspects of the FTP administration? Should a cmdlet that works for webbies work for FTP sites as well? I dont get it...

     


    br4tt3
    Monday, November 22, 2010 10:04 AM
  • it´s funny, yesterday i tried the same, with the same porblem....

    i tried to manipulate the state in the applicationhost config, i finnally could commit it, but it wouldn´t update....

    the  API somehow feels a little bit beta, like the cmdlets...

     if you find a solution please let me know....

    Tuesday, November 23, 2010 7:11 AM
  • Hi,

    It’s a known issue. The cuase is that FTP sites are different from HTTP sites and some of the tools look for the HTTP binding information in order to work (‘pure’ FTP sites would not have the http binding). Product team is aware of this issue. Hope them will resolve it soon. If there is any update, I will post it here.

    Thanks.

     


    This posting is provided "AS IS" with no warranties, and confers no rights. Please remember to click "Mark as Answer" on the post that helps you, and to click "Unmark as Answer" if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
    • Marked as answer by br4tt3 Thursday, December 2, 2010 1:22 PM
    Wednesday, November 24, 2010 7:34 AM
  • will you still update this question, or is there ab buglist where we can look up when it´s fixed?
    Thursday, December 2, 2010 5:16 PM
  • Hi,

    Sorry to say no plan for this issue was made currently. If there is any update, I will post it here. Thank you for your patient.

    Regards 


    This posting is provided "AS IS" with no warranties, and confers no rights. Please remember to click "Mark as Answer" on the post that helps you, and to click "Unmark as Answer" if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
    Tuesday, December 7, 2010 3:06 AM
  • Hi. This is an old post but still the problem exists. Was this issue addressed? If not, is there an open issue to it?

    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
    
    


    Friday, April 11, 2014 1:34 PM