I am working on an automated set up of a web server using PowerShell and I need to create a virtual directory which I am able to do using the following code
New-Item 'IIS:\Sites\Default Web Site\folder' -type VirtualDirectory -physicalPath $folder
I also need to set this virtual directory so that it will allow clients to upload files, which can be done manually by opening the BITS Uploads feature and checking the "Allow clients to upload files" check box.
Is there a way to set this using PowerShell?
Thanks in advance
The following example shows how to use PowerShell to enable an IIS virtual directory for BITS uploads. It use System.DirectoryServices to setup virtual directory, it deals with IIS 6 classes, and it also works on IIS 7 if the IIS 6 Management Compatibility feature is installed (see Creating Sites and Virtual Directories Using System.DirectoryServices).
$root = new-object system.directoryservices.directoryentry("IIS://127.0.0.1/W3SVC/1/Root/folder")
$root.EnableBITSUploads()
#$root.BITSUploadEnabled = $true
#$root.setinfo()