PoshCode Archive  Artifact [645a65cebf]

Artifact 645a65cebfb0bb0c88a265bc819554a101ff57f38451eabf0788b4278b783ed8:

  • File McAfeeAPI_01Connect.ps1 — part of check-in [1aaf493280] at 2018-06-10 13:24:13 on branch trunk — McAfee Web API module functions. [Set001] (user: Vidrine size: 1018)

# 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