Automatic IIS FTP server installation on Windows 7

For a certain application, a locally installed FTP server was required. Scripting this seemed easy, and plenty of examples could be found but none worked properly. So I’m sharing my method with you. Below code installs FTP. The final 3 lines enable anonymous authentication and create a Default FTP site that points to c:\temp

Hope it helps someone! Do note the reboot is actually mandatory.

dism.exe /Online /Enable-Feature /FeatureName:IIS-FTPExtensibility /FeatureName:IIS-FTPServer /FeatureName:IIS-FTPSvc /FeatureName:IIS-IIS6ManagementCompatibility /FeatureName:IIS-ManagementConsole /FeatureName:IIS-ManagementScriptingTools /FeatureName:IIS-ManagementService /FeatureName:IIS-Metabase /FeatureName:IIS-WebServer /FeatureName:IIS-WebServerManagementTools /FeatureName:IIS-WebServerRole /FeatureName:IIS-WindowsAuthentication
%windir%\system32\inetsrv\AppCmd set config -section:system.applicationHost/sites /"True" /commit:apphost
%windir%\system32\inetsrv\AppCmd add site /name:"Default FTP Site" /bindings:ftp://localhost:21 /physicalpath:c:\temp\
%windir%\system32\inetsrv\AppCmd ADD vdir /"Default FTP Site/" /physicalpath:c:\temp