PoshCode Archive  Artifact [314f5dbde5]

Artifact 314f5dbde5aa0b38c99c3bfbffb36bea8695d6442fbd8abbc5d6fdab55c0b1ea:

  • File Test-WebDAV.ps1 — part of check-in [6959a51dbc] at 2018-06-10 13:24:21 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: 3357
# x-archived: 2016-11-28T14:07:12
# x-published: 2012-04-16T02:24: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 }
}