-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathePO_API.ps1
More file actions
48 lines (41 loc) · 1.25 KB
/
Copy pathePO_API.ps1
File metadata and controls
48 lines (41 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
cls
add-type @"
using System.Net;
using System.Security.Cryptography.X509Certificates;
public class TrustAllCertsPolicy : ICertificatePolicy {
public bool CheckValidationResult(
ServicePoint srvPoint, X509Certificate certificate,
WebRequest request, int certificateProblem) {
return true;
}
}
"@
[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
###########################
# Some Inits
###########################
# IP or FQDN of local ePO
$global:ePOIP = '10.10.10.204'
# ePO Port
$global:ePOPort = '8443'
# ePO Credentials
$global:cred = Get-Credential
###########################
# Main Function
###########################
Function Main
{
$response = CallePOApi 'DxlBrokerMgmt.registerIpeDataCmd' @{packageLocation = "C:\temp\somefile.xml"}
Write-Host $response
}
###########################
# Call ePO API
###########################
Function CallePOApi ([String]$method, $body)
{
$url = 'https://' + $global:ePOIP + ":" + $global:ePOPort + '/remote/' + $method
$response = Invoke-WebRequest $url -Credential $global:cred -Method Post -Body $body
return $response
}
Main;