IIS Virtual Directory Bits Upload [Answered]RSS

6 replies

Last post Apr 07, 2016 08:17 AM by Jean Sun

  • IIS Virtual Directory Bits Upload

    Mar 31, 2016 10:52 PM|Arphaxad|LINK

    Hello Everyone.

    I'm trying to set with a PS script various configurations for many Web Pages in my Windows Server 2008 R2. I have researched of how can I make a new web site in IIS and to create a new virtual directory, but I cant manage to set the "Allow clients to upload files". I have already install all the IIS and Bits features.

    This is how I make the web site and virtual directory.

    Import-Module WebAdministration
    New-Item iis:\Sites\GS_BITS -bindings @{protocol="http";bindingInformation="*:8736:"} -physicalPath "C:\GS_BITS"
    New-Item IIS:\Sites\GS_BITS\Uploads -type VirtualDirectory -physicalPath "C:\GS_BITS"

    I found too Little information of how can I set the allow clientes to upload files to true:

    (Like this)

    $root = new-object system.directoryservices.directoryentry("IIS://127.0.0.1/W3SVC/1/Root/folder")
    $root
    .EnableBITSUploads()

    or

    $root = new-object system.directoryservices.directoryentry("IIS://localhost/W3SVC/1/Root/folder")
    $root
    .EnableBITSUploads()

    I tryied to change the nombre of the folder but it doesnt work.

    Do you have any idea?

  • Re: IIS Virtual Directory Bits Upload

    Apr 01, 2016 02:05 AM|Jean Sun|LINK

    Hi,

    Did you get any error message? Could you please post the error message here?

    Best Regards,

    Jean

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue.
    If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
  • Re: IIS Virtual Directory Bits Upload

    Apr 01, 2016 09:56 PM|Arphaxad|LINK

    Yes I got the following error message with

    $root = new-object system.directoryservices.directoryentry("IIS://localhost/W3SVC/1/Root/folder")
    $root.EnableBITSUploads()

     Exception to recover the " EnableBITSUploads " Member : " The system can not find the path specified . "

      $root.EnableBITSUploads <<<< ()
    + CategoryInfo          : NotSpecified: (:) [], ExtendedTypeSystemException
    + FullyQualifiedErrorId : CatchFromBaseGetMember

    I got the same error message if I use IIS://localhost.

    Now I thought I could use my virtual folder with

    $root = new-object system.directoryservices.directoryentry("IIS://localhost/W3SVC/1/GS_BITS/Uploads")
    $root.EnableBITSUploads()
    

    And I recieve the same error.

  • Re: IIS Virtual Directory Bits Upload

    Apr 04, 2016 05:45 AM|Jean Sun|LINK

    Hi,

    This error indicates that you used a wrong path.

    When you use this "IIS://localhost/W3SVC/1/Root/folder" , you need to make sure you have "folder" at the root of the site with ID 1 under IIS.

    Best Regards,

    Jean

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue.
    If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
  • Re: IIS Virtual Directory Bits Upload

    Apr 04, 2016 02:21 PM|Arphaxad|LINK

    Hello Thanks. I research for more info and I needed to use "IIS://LocalHost/W3SVC/2/root/Uploads". The folder Uploads is a Virtual directory. When I try to use EnableBitsUplodas I got another error.

    I'm Using the following code now

    $siteObj = New-Object System.DirectoryServices.DirectoryEntry("IIS://LocalHost/W3SVC/2/root/Uploads")
    $siteObj.EnableBitsUploads()

    And the error I get is this one:

    Exception calling " EnableBitsUploads " with arguments " 0" : " You can not change thread mode after
     set. (Exception from HRESULT : 0x80010106 ( RPC_E_CHANGED_MODE ) ) "

    +     $siteObj.EnableBitsUploads <<<< ()
        + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
        + FullyQualifiedErrorId : CatchFromBaseAdapterMethodInvokeTI 

  • Re: IIS Virtual Directory Bits Upload

    Apr 07, 2016 08:09 AM|Jean Sun|LINK

    Hi,

    Please check the "Connect As" setting of your virtual directory, try set "Path Credentials" to a specific user.

    After I changed that, I can run this script without any exception on my side. Below are the steps:

    1. Open IIS Manager -> Navigate to the virtual folder

    2. Click Basic Settings on the Actions Pane

    3. Click Connect As, edit the Path Credentials

    And I followed the steps in the following link to enable bits upload.

    https://blogs.msdn.microsoft.com/wmi/2010/04/02/configuring-bits-upload-server-with-powershell-and-adsi/

    Best Regards,

    Jean

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue.
    If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
  • Re: IIS Virtual Directory Bits Upload

    Apr 07, 2016 08:17 AM|Jean Sun|LINK

    Hi,

    Another point...

    I can run this script successfully only on the Server version of Windows(Windows Server 2012 R2).

    And before I ran this command I enable the BITS IIS Server Extension.

    Best Regards,

    Jean

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue.
    If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.