Enabling Virtual Directory FTP Directory Browsing via powerShell

Hey EE,

My co-workers and I are trying to right a powerShell script to enable the Virtual Directories feature under FTP Directory Browsing for an FTP site that we've created.  The concept is obviously to automate our server setup procedure.  I have been looking for quite sometime on how to write the above mentioned script; however, can't really seem to find a way to enable that flag.  I stumbled upon the appcmd exe and thought that might be a way to do it; however, I can't seem to figure that out either.  I thought the following would solve my issue:

c:\Windows\system32\inetsrv\appcmd.exe set config "ftp" /section:directoryBrowse /enabled:true

That enables directory browsing on a virtual directory called test, which isn't what I need...

Please help,

Christopher Medina
Christopher MedinaSystems AdministratorAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Christopher MedinaSystems AdministratorAuthor Commented:
I've found the answer to my solution using just PowerShell:  

Param(
      [Parameter(Mandatory=$true)]
      [string]$siteName = 'test'
)

$ErrorActionPreference = "Stop"

Import-Module WebAdministration
Set-ItemProperty "IIS:\Sites\$siteName" -Name ftpServer.directoryBrowse.showFlags -Value "DisplayVirtualDirectories"
Write-Output "FTP Directory Browsing was set for site $siteName"

This will prompt you to enter the FTP site name and it will make the changes to the specified site.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows Server 2012

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.