[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 618
  • Last Modified:

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 Medina
Christopher Medina
1 Solution
Christopher MedinaAuthor Commented:
I've found the answer to my solution using just PowerShell:  

      [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.

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now