Powershell Script to check the Authetication of an Internet site


i again , seeking for script in powershell.

i need check authentication @ internet sharepoint site. if authentication fails should alert immediately. want configure @ local system not available in office network.


santosh sethi

are wanting request url , provide authentication , and alert if authentication fails?  if so, should able create httpwebrequest object , set credentials property (or use default), call getresponse() method , trap http 401 response.

$url = "https://example.com" $request = [system.net.httpwebrequest]::create($url) $request.usedefaultcredentials = $true #can set use process account try { 	$response = $request.getresponse() } catch { 	if ($_.exception.message.indexof("(401) unauthorized.") -ge 0) 	{ 		#add alert here 	} } { 	if ($response -ne $null) 	{ 		$response.close() 	} }

don't understand statement want configure - can explain more if has implications on writing script?


Windows Server  >  Windows PowerShell



Comments

Popular posts from this blog

CRL Revocation always failed

Failed to query the results of bpa xpath

0x300000d errors in Microsoft Remote Desktop client