PoshCode Archive  Artifact [80af64875f]

Artifact 80af64875f2b7017d848add6b68efef00d277cd16268f65525a64ad4b7bfc613:

  • File Test-WebDAV.ps1 — part of check-in [b6cc488882] at 2018-06-10 12:56:28 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: 1120
# x-archived: 2017-05-01T04:26:09
# x-published: 2010-05-21T08:36: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 }
}