# encoding: ascii
# api: powershell
# title: McAfeeAPI_01Connect
# description: McAfee Web API module functions. [Set001]
# version: 0.1
# type: function
# author: Vidrine
# license: CC0
# function: McAfee-Connect
# x-poshcode-id: 3344
# x-archived: 2012-04-14T02:00:27
# x-published: 2012-04-11T14:49:00
#
# This set of module functions is to establish the connections needed to call the McAfee Web API through a P$ web client.
#
#region << ePO Connection and Initialization >>
function McAfee-Connect{
	param([String]$script:ServerURL="SERVERNAME:8443")
	$c = McAfee-Credential
	$script:wc = McAfee-WebClient -Credential $c
}

function McAfee-Credential{
	$c = Get-Credential -Credential $null
	return $c
}

function McAfee-WebClient{
	param($Credential)
	$wc = new-object system.net.webclient
	$wc.credentials = New-Object System.Net.NetworkCredential -ArgumentList ($Credential.GetNetworkCredential().username,$Credential.GetNetworkCredential().password)
	return $wc
}
#endregion
