PoshCode Logo PowerShell Code Repository

Test-WebDAV (modification of post by view diff)
embed code: <script type="text/javascript" src="http://PoshCode.org/embed/1120"></script>download | new post

Quickly tests if a given web server (specified by Url parameter) is running a WebDAV service. Should work against any server platform that supports the WebDAV RFCs.

  1. function Test-WebDav ()
  2. {
  3.         param ( $Url = "$( throw 'URL parameter is required.')" )
  4.         $xhttp = New-Object -ComObject msxml2.xmlhttp
  5.         $xhttp.open("OPTIONS", $url, $false)
  6.         $xhttp.send()
  7.         if ( $xhttp.getResponseHeader("DAV") ) { $true }
  8.         else { $false }
  9. }

Submit a correction or amendment below (
click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:


Remember me