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