-
Notifications
You must be signed in to change notification settings - Fork 36
Expand file tree
/
Copy pathGet-DellInformation.ps1
More file actions
42 lines (36 loc) · 1.56 KB
/
Get-DellInformation.ps1
File metadata and controls
42 lines (36 loc) · 1.56 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
#iDRAC9 IP and credentials
$iDRAC9 = '192.168.34.224'
$credentials = Get-Credential -Message "Type iDRAC9 credentials" -UserName root
try
{
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
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12 -bor [Sytstem.Net.SecurityProtocolType]::Tls11
Write-Host 'Allowed SelfSigned SSL certificate for this iDRAC session'
}
catch
{
Write-Host 'Already Allowed SelfSigned SSL certificate for this iDRAC session'
}
#curl example
#curl "https://<iDRAC IP>/redfish/v1/Chassis" -k -u root:calvin
#Example API URI to get iDRAC9 Information
$basicAPIUrl = 'https://$iDRAC9/redfish/v1'
$systemAPIUrl = 'https://$iDRAC9/redfish/v1/Systems/System.Embedded.1'
#Common Header Example
$Headers = @{'Accept'='application/json'}
#Results
$basicInfo = Invoke-RestMethod -Uri $basicAPIUrl -Credential $credentials -Method Get -ContentType 'application/json' -Headers $Headers #-UseBasicParsing
$basicInfo
$systemInfo = Invoke-RestMethod -Uri $basicAPIUrl -Credential $credentials -Method Get -ContentType 'application/json' -Headers $Headers #-UseBasicParsing
$systemInfo.MemorySummary