PoshCode Archive  Artifact Content

Artifact 5615f08aa1b5f6ed1ff5c80b334d4047c40e06f496c68bd830a657f0db7c8513:

  • File Test-WebDAV.ps1 — part of check-in [5bfd8d46f1] at 2018-06-10 13:14:27 on branch trunk — 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. (user: halr9000 size: 700)

# encoding: ascii
# api: powershell
# title: Test-WebDAV
# description: 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.
# version: 0.1
# type: function
# author: halr9000
# license: CC0
# function: Test-WebDav
# x-poshcode-id: 2691
# x-archived: 2011-05-27T22:46:29
# x-published: 2011-05-24T03:49:00
#
#
function Test-WebDav ()
{
	param ( $Url = "$( throw 'URL parameter is required.')" )
	$xhttp = New-Object -ComObject msxml2.xmlhttp
	$xhttp.open("OPTIONS", $url, $false)
	$xhttp.send()
	if ( $xhttp.getResponseHeader("DAV") ) { $true }
	else { $false }
}