Windows 2022
Sponsored Link

IIS : WebDAV Setting2022/01/26

 
Configure WebDAV Setting to use File sharing over HTTP.
[1] Run PowerShell with Admin Privilege and Configure.
On this example, Configure settings that set a virtual directory under a Web Site and set WebDAV to the directory. And also create a local group [DavGroup] to allow read and write permission for them to WebDAV directory.
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

# install WebDAV feature
PS C:\Users\Administrator> Install-WindowsFeature Web-DAV-Publishing 

Success Restart Needed Exit Code      Feature Result
------- -------------- ---------      --------------
True    No             Success        {WebDAV Publishing}

# restart IIS
PS C:\Users\Administrator> Restart-Service W3SVC 

# create a group [DavGroup]
PS C:\Users\Administrator> New-LocalGroup -Name "DavGroup" 

Name     Description
----     -----------
DavGroup

# add a user to [DavGroup] group
# (the user you allow to access to WebDAV directory)
PS C:\Users\Administrator> Add-LocalGroupMember -Group "DavGroup" -Member "Serverworld" 


PS C:\Users\Administrator> Get-Website 

Name             ID   State      Physical Path                  Bindings
----             --   -----      -------------                  --------
Default Web Site 1    Started    %SystemDrive%\inetpub\wwwroot  http *:80:
RX-7.srv.world   2    Started    C:\inetpub\newsite             http *:80:rx-7.srv.world
                                                                https *:443:rx-7.srv.world sslFlags=0

# create [webdav] folder
PS C:\Users\Administrator> mkdir C:\inetpub\webdav 

# set [webdav] folder as a virtual directory on IIS
PS C:\Users\Administrator> New-WebVirtualDirectory -Site "RX-7.srv.world" -Name "webdav" -PhysicalPath "C:\inetpub\webdav" 

Name   PhysicalPath
----   ------------
webdav C:\inetpub\webdav

# enable WebDAV feature
PS C:\Users\Administrator> Set-WebConfigurationProperty -Filter '/system.webServer/webdav/authoring' -Location "RX-7.srv.world" -Name enabled -Value True 

# disable anonymous authentication on [webdav] folder
PS C:\Users\Administrator> Set-WebConfigurationProperty -Filter '/system.webServer/security/authentication/anonymousAuthentication' -Location "RX-7.srv.world/webdav" -Name enabled -Value False 

# enable basic authentication on [webdav] folder
PS C:\Users\Administrator> Set-WebConfigurationProperty -Filter '/system.webServer/security/authentication/basicAuthentication' -Location "RX-7.srv.world/webdav" -Name enabled -Value True 

# allow Read,Write,Source persmission to [webdav] folder for [DavGroup] group
PS C:\Users\Administrator> Add-WebConfiguration -Filter "/system.webServer/webdav/authoringRules" -Location "RX-7.srv.world/webdav" -Value @{path="*";roles="DavGroup";access="Read,Write,Source"} 

# allow full control NTFS permission to [webdav] folder for [DavGroup] group
PS C:\Users\Administrator> icacls "C:\inetpub\webdav" /grant "DavGroup:(OI)(CI)(F)" 
processed file: C:\inetpub\webdav
Successfully processed 1 files; Failed processing 0 files

# enable [Directory Browsing] to [webdav] folder
PS C:\Users\Administrator> Set-WebConfigurationProperty -Filter '/system.webServer/directoryBrowse' -Location "RX-7.srv.world/webdav" -Name enabled -Value True 

# restart the target Web site
PS C:\Users\Administrator> Restart-WebItem -PSPath 'IIS:\Sites\RX-7.srv.world' 

# verify accesse ⇒ [-u (username)]
PS C:\Users\Administrator> curl.exe -u Serverworld https://rx-7.srv.world/webdav/ 
Enter host password for user 'Serverworld':     # user password

<html><head><title>rx-7.srv.world - /webdav/</title></head><body><H1>rx-7.srv.world - /webdav/</H1><hr>

<pre><A HREF="/">[To Parent Directory]</A><br><br></pre><hr></body></html>
IIS : WebDAV Setting (GUI)
 
On GUI configuration, set like follows.
[2] Create a users or groups to allow to access to WebDAV folder.
On this example, create a [DavGroup] group and add [Serverworld] user to it to allow WebDAV access.
To add local users and so on, refer to here.
[3] Install WebDAV feature.
Run [Start] - [Server Manager] and enter [Add roles and features], then check a box [WebDAV Publishing] and install it. After installing it, restart IIS service.
[4] Create a folder for WebDAV.
On this example, set a virtual directory [webdav] like follows (physical path is [C:inetpubwebdav]).
To set virtual directory, refer to here.
[5] Select a Web site you'd like to set WebDAV on the left pane and then, Click to open [WebDAV Authoring Rules] on the center pane.
[6] Click [Enable WebDAV] on the right pane.
[7] Select a folder for WebDAV and then, Click to open [WebDAV Authoring Rules] on the center pane.
[8] Click to open [Add Authoring Rule] on the right pane.
[9] Set access permission for WebDAV accesses. On this example, set like follows.
[10] It also needs NTFS access permission for WebDAV folder. Select WebDAV folder and right clicking it, then select to open [Access permission], then add permissions for your requirements.
[11] Select a folder for WebDAV and then, Click to open [Authentication] on the center pane.
[12] Disable [Anonymous Authentication] and Enable [Basic Authentication] like follows.
[13] Select a folder for WebDAV and then, Click to open [Directory Browsing] on the center pane.
[14] Click [Enable] on the right pane. For information to display, select the one you'd like to set.
[15] That's OK. Access to the URL of WebDAV folder with Web Browser. If success authentication and displayed content of WebDAV folder, settings are no ploblem.
IIS : WebDAV Setting : WebDAV Client
 
This is how to access to WebDAV folder from Client Computers.
This example in on Windows 11.
There are many WebDAV client softwares in the world, but on this example, use Windows WebDAV client feature.
[16] Open [This PC] and move to [Computer] tab, then Click [Add a network location].
[17] Click [Next] button.
[18] Click [Next] button.
[19] Input WebDAV folder's URL and Click [Next] button.
[20] Authenticate with a user you set to allow to access.
[21] After successfully finished authentication, Input any name to WebDAV folder that is used on your PC.
[22] Click [Finish] button.
[23] If successfully accessed to WebDAV folder, verify to read and write files or directories.
Matched Content