HPERedfishExamples.ps1

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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
<#
(c) Copyright 2016-2018 Hewlett Packard Enterprise Development LP
 
Licensed under the Apache License, Version 2.0 (the "License");
You may not use this file except in compliance with the License.
You may obtain a copy of the License at
 
    http://www.apache.org/licenses/LICENSE-2.0
 
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
 
 
 
 
These examples use HPE Redfish PowerShell cmdlets available at http://www.powershellgallery.com/packages/HPERedfishCmdlets/.
These scripts provide examples of using HPE Redfish API on HPE iLO for common use cases.
 
These examples use the following base set of cmdlets:
 
Connect-HPERedfish
Disable-HPERedfishCertificateAuthentication
Disconnect-HPERedfish
Edit-HPERedfishData
Enable-HPERedfishCertificateAuthentication
Find-HPERedfish
Format-HPERedfishDir
Get-HPERedfishData
Get-HPERedfishDataRaw
Get-HPERedfishDir
Get-HPERedfishHttpData
Get-HPERedfishIndex
Get-HPERedfishMessage
Get-HPERedfishModuleVersion
Get-HPERedfishSchema
Get-HPERedfishSchemaExtref
Get-HPERedfishUriFromOdataId
Invoke-HPERedfishAction
Remove-HPERedfishData
Set-HPERedfishData
Test-HPERedfishCertificateAuthentication
 
#>



 
#iLO IP address and credentials to access the iLO
$Address = '192.168.21.12'
$cred = Get-Credential
Disable-HPERedfishCertificateAuthentication

function Reset-ServerExample1
{
param
    (
        [System.String]
        $Address,

        [PSCredential]
        $Credential,

        [System.String]
        $Action,

        [System.String]
        $PropertyName,

        [System.String]
        $PropertyValue
    )

    Write-Host 'Example 1: Reset the server.'
    
    #create session
    $session = Connect-HPERedfish -Address $Address -Credential $Credential

    # getting system list
    $systems = Get-HPERedfishDataRaw -odataid '/redfish/v1/systems/' -Session $session
    foreach($sys in $systems.members.'@odata.id') # /redfish/v1/systems/1/, /redfish/v1/system/2/
    {
        $sysData = Get-HPERedfishDataRaw -odataid $sys -Session $session

        # creating setting object to invoke reset action.
        # Details of invoking reset (or other possible actions) is present in 'Actions' of system data
        $dataToPost = @{}
        $dataToPost.Add($PropertyName,$PropertyValue)
        
        # Sending reset request to system using 'POST' in Invoke-HPERedfishAction
        $ret = Invoke-HPERedfishAction -odataid $sysData.Actions.'#ComputerSystem.Reset'.target -Data $dataToPost -Session $session

        # processing message obtained by executing Set- cmdlet
        if($ret.error.'@Message.ExtendedInfo'.Count -gt 0)
        {
            foreach($msgID in $ret.error.'@Message.ExtendedInfo')
            {
                $status = Get-HPERedfishMessage -MessageID $msgID.MessageID -MessageArg $msgID.MessageArgs -Session $session
                $status
            }
        }
    }

    # disconnect the session after use
    Disconnect-HPERedfish -Session $session
}
#Reset-ServerExample1 -Address $Address -Credential $cred -Action Reset -PropertyName ResetType -PropertyValue ForceRestart

function Set-SecureBootExample2
{
    param
    (
        [System.String]
        $Address,

        [PSCredential]
        $Credential,

        [System.String]
        $SecureBootProperty, # schema allows changing values for SecureBootEnable, ResetToDefaultKeys, ResetAllKeys

        [Boolean]
        $Value #value must be a boolean i.e. $true or $false
    )

    Write-Host 'Example 2: Enable/Disable UEFI secure boot'
    
    #create session
    $session = Connect-HPERedfish -Address $Address -Credential $Credential

    $systems = Get-HPERedfishDataRaw -odataid '/redfish/v1/systems/' -Session $session
    foreach($sys in $systems.members.'@odata.id') # /redfish/v1/systems/1/, /redfish/v1/system/2/
    {
        #Get secure boot URI
        $sysData = Get-HPERedfishDataRaw -odataid $sys -Session $session
        
        # for iLO 5
        $secureBootOdataId = $sysData.SecureBoot.'@odata.id'
        
        ## for iLO 4
        #$secureBootOdataId = $sysData.Oem.Hp.Links.SecureBoot.'@odata.id'
    
        #get secure boot data and display original value
        $secureBootData = Get-HPERedfishDataRaw -odataid $secureBootOdataId -Session $session
        $secureBootData

        #if property to be modified is not present in the secure boot data, then print error message and return
        if(-not(($secureBootData|Get-Member).Name -Contains $SecureBootProperty))
        {
            Write-Host "Property $SecureBootProperty is not supported on this system"
        }
        else
        {
            # use Set cmdlet at Secure Boot odataid to update secure boot property. Here only boolean values are allowed for Value parameter
            # creating hashtable object with property and value
            $secureBootSetting = @{$SecureBootProperty=$Value}
            
            # Execute Set- cmdlet to post enable/disable setting at odataid for secure boot
            $ret = Set-HPERedfishData -odataid $secureBootOdataId -Setting $SecureBootSetting -Session $session
            
            # processing message obtained by executing Set- cmdlet
            if($ret.error.'@Message.ExtendedInfo'.Count -gt 0)
            {
                foreach($msgID in $ret.error.'@Message.ExtendedInfo')
                {
                    $status = Get-HPERedfishMessage -MessageID $msgID.MessageID -MessageArg $msgID.MessageArgs -Session $session
                    $status
                }
            }

            # get and display updated value of the property
            $secureBootData = Get-HPERedfishDataRaw -odataid $secureBootOdataId -Session $session
            $secureBootData        
        }
    }

    # disconnect the session after use
    Disconnect-HPERedfish -Session $session
}
#Set-SecureBootExample2 -Address $Address -Credential $cred -SecureBootProperty 'SecureBootEnable' -Value $false

function Set-TempBootOrderExample3
{
    param
    (
        [System.String]
        $Address,

        [PSCredential]
        $Credential,

        [System.String]
        $BootTarget
    )

    Write-Host 'Example 3: Set one-time(temporary)boot order'
    
    #create session
    $session = Connect-HPERedfish -Address $Address -Credential $Credential

    #Get system list
    $systems = Get-HPERedfishDataRaw -odataid '/redfish/v1/systems/' -Session $session
    foreach($sys in $systems.Members.'@odata.id') # /redfish/v1/systems/1/, /redfish/v1/system/2/
    {
        # get boot data for the system
        $sysData = Get-HPERedfishDataRaw -odataid $sys -Session $session
        Write-Host $sysData.Boot

        # create object to PATCH
        $tempBoot = @{'BootSourceOverrideTarget'=$BootTarget}
        $OneTimeBoot = @{'Boot'=$tempBoot}

        # PATCH the data using Set-HPERedfishData cmdlet
        $ret = Set-HPERedfishData -odataid $sys -Setting $OneTimeBoot -Session $session
            
        #process message returned by Set-HPERedfishData cmdlet
        if($ret.error.'@Message.ExtendedInfo'.Count -gt 0)
        {
            foreach($msgID in $ret.error.'@Message.ExtendedInfo')
            {
                $status = Get-HPERedfishMessage -MessageID $msgID.MessageID -MessageArg $msgID.MessageArgs -Session $session
                $status
            }
        }

        #get and print updated value
        $bootData = Get-HPERedfishDataRaw -odataid $sys -Session $session
        $bootData.Boot
    }

    # disconnect the session after use
    Disconnect-HPERedfish -Session $session
}
## NOTE: The value is case sensitive.
#check the boot targets supported:
# in iLO 5 check BootSourceOverrideTarget@Redfish.AllowableValues and UefiTargetBootSourceOverride@Redfish.AllowableValues under $sysData.Boot
# in iLO 4 check BootSourceOverrideSupported $sysData.Boot.BootSourceOverrideSupported).

## E.g. Pxe will work, pxe will not
#Set-TempBootOrderExample3 -Address $Address -Credential $cred -BootTarget 'Hdd'

function Get-iLOMACAddressExample4
{
    param
    (
        [System.String]
        $Address,

        [PSCredential]
        $Credential
    )

    Write-Host "Example 4: Find iLO's MAC addresses"
    
    #create session
    $session = Connect-HPERedfish -Address $Address -Credential $Credential

    $managers = Get-HPERedfishDataRaw -odataid '/redfish/v1/managers/' -Session $session
    foreach($manager in $managers.members.'@odata.id') # /redfish/v1/managers/1/, /redfish/v1/managers/2/
    {
        #Get manager data
        $managerData = Get-HPERedfishDataRaw -odataid $manager -Session $session
        
        # retrieve ethernet NIC details
        $nicURI = $managerData.EthernetInterfaces.'@odata.id'
        $nicListData = Get-HPERedfishDataRaw -odataid $nicURI -Session $session

        foreach($nicOdataId in $nicListData.Members.'@odata.id')
        {
            $nicData = Get-HPERedfishDataRaw -odataid $nicOdataId -Session $session
            Write-Host $nicData.Name - $nicData.MacAddress 
        }
    }

    # disconnect session after use
    Disconnect-HPERedfish -Session $session
}
#Get-iLOMACAddressExample4 -Address $Address -Credential $cred

function Add-iLOUserAccountExample5
{
# NOTE: '(400) Bad Request' error will be thrown if the user already exists
    param
    (
        [System.String]
        $Address,

        [PSCredential]
        $Credential,

        [System.String]
        $newiLOLoginName,

        [System.String]
        $newiLOUserName,

        [System.String]
        $newiLOPassword,

        [Boolean]
        $RemoteConsolePriv = $false,

        [Boolean]
        $ConfigPriv = $false,

        [Boolean]
        $VirtualMediaPriv = $false,

        [Boolean]
        $UserConfigPriv = $false,

        [Boolean]
        $VirtualPowerResetPriv = $false
    )

    Write-Host 'Example 5: Create an iLO user account.'

    #create session
    $session = Connect-HPERedfish -Address $Address -Credential $Credential

    # Get AccountService data to obtain Accounts odataid
    $accData = Get-HPERedfishDataRaw -odataid '/redfish/v1/AccountService/' -Session $session
    $accOdataId = $accData.Accounts.'@odata.id'

    # create iLO user object
    # add permissions
    $priv = @{}
    $priv.Add('RemoteConsolePriv',$RemoteConsolePriv)
    $priv.Add('iLOConfigPriv',$ConfigPriv)
    $priv.Add('VirtualMediaPriv',$VirtualMediaPriv)
    $priv.Add('UserConfigPriv',$UserConfigPriv)
    $priv.Add('VirtualPowerAndResetPriv',$VirtualPowerResetPriv)

    # add login name
    $hp = @{}
    $hp.Add('LoginName',$newiLOLoginName)
    $hp.Add('Privileges',$priv)
    
    $oem = @{}
    # for iLO 5
    $oem.Add('Hpe',$hp)
    
    ## for iLO 4
    #$oem.Add('Hp',$hp)

    # add username and password for access
    $user = @{}
    $user.Add('UserName',$newiLOUserName)
    $user.Add('Password',$newiLOPassword)
    $user.Add('Oem',$oem)

    # execute HTTP POST method using Invoke-HPERedfishAction to add user data at Accounts odata_id
    $ret = Invoke-HPERedfishAction -odataid $accOdataId -Data $user -Session $session
    $ret

    # disconnect session after use
    Disconnect-HPERedfish -Session $session
}
#Add-iLOUserAccountExample5 -Address $Address -Credential $cred -newiLOLoginName 'timh1' -newiLOUserName 'TimHorton' -newiLOPassword 'timPassword123' -RemoteConsolePriv $true

function Set-iLOUserAccountExample6
{
    param
    (
        [System.String]
        $Address,

        [PSCredential]
        $Credential,

        [System.String]
        $LoginNameToModify,

        [System.String]
        $newLoginName = '',

        [System.String]
        $newUsername = '',

        [System.String]
        $newPassword = '',

        [System.Object]
        $RemoteConsolePriv = $null,

        [System.Object]
        $ConfigPriv = $null,

        [System.Object]
        $VirtualMediaPriv = $null,

        [System.Object]
        $UserConfigPriv = $null,

        [System.Object]
        $VirtualPowerResetPriv = $null
    )

    Write-Host 'Example 6: Modify an iLO user account.'

    #create session
    $session = Connect-HPERedfish -Address $Address -Credential $Credential

    # get the odataid of the iLO user accounts
    $accData = Get-HPERedfishDataRaw -odataid '/redfish/v1/AccountService/' -Session $session
    $accOdataId = $accData.Accounts.'@odata.id'

    $accounts = Get-HPERedfishDataRaw -odataid $accOdataId -Session $session
    $foundFlag = $false
    $requiredAccountOdataId = ''
    $user = $null

    foreach($accountMemberOdataId in $accounts.Members.'@odata.id')
    {
        $accountDetails = Get-HPERedfishDataRaw -odataid $accountMemberOdataId -Session $session

        # check if user is present in the user list
        if($accountDetails.Username -eq $LoginNameToModify)
        {
            $foundFlag = $true
            $requiredAccountOdataId = $accountDetails.'@odata.id'
            
            # Create user object with new value(s)
            $priv = @{}
            if($RemoteConsolePriv -ne $null){$priv.Add('RemoteConsolePriv',[System.Convert]::ToBoolean($RemoteConsolePriv))}
            if($ConfigPriv -ne $null){$priv.Add('iLOConfigPriv',[System.Convert]::ToBoolean($ConfigPriv))}
            if($VirtualMediaPriv -ne $null){$priv.Add('VirtualMediaPriv',[System.Convert]::ToBoolean($VirtualMediaPriv))}
            if($UserConfigPriv -ne $null){$priv.Add('UserConfigPriv',[System.Convert]::ToBoolean($UserConfigPriv))}
            if($VirtualPowerResetPriv -ne $null){$priv.Add('VirtualPowerAndResetPriv',[System.Convert]::ToBoolean($VirtualPowerResetPriv))}

            $hp = @{}
            if($newLoginName -ne ''){$hp.Add('LoginName',$newLoginName)}
            if($priv.Count -gt 0){$hp.Add('Privileges',$priv)}
    
            $oem = @{}
            # for iLO 5
            if($hp.Count -gt 0){$oem.Add('Hpe',$hp)}
            
            ## for iLO 4
            #if($hp.Count -gt 0){$oem.Add('Hp',$hp)}

            $user = @{}
            if($newUserName -ne ''){$user.Add('UserName',$newUserName)}
            if($newPassword -ne ''){$user.Add('Password',$newPassword)}
            if($oem.Count -gt 0){$user.Add('Oem',$oem)}
            break
        }
    }
    if($foundFlag -eq $true)
    {
        # WARNING: If you don't change anything, you will get an HTTP 400 back
        # PATCH the data using Set-HPERedfishData
        $ret = Set-HPERedfishData -odataid $requiredAccountOdataId -Setting $user -Session $session
        if($ret.error.'@Message.ExtendedInfo'.Count -gt 0)
        {
            foreach($msgID in $ret.error.'@Message.ExtendedInfo')
            {
                $status = Get-HPERedfishMessage -MessageID $msgID.MessageID -MessageArg $msgID.MessageArgs -Session $session
                $status
            }
        }
    }
    # If user name is not found, print message
    else
    {
        Write-Error "$LoginNameToModify not present"
    }

    # Disconnect session after use
    Disconnect-HPERedfish -Session $session
}
#Set-iLOUserAccountExample6 -Address $Address -Credential $cred -LoginNameToModify 'TimHorton' -RemoteConsolePriv $false

function Remove-iLOUserAccountExample7
{
    param
    (
        [System.String]
        $Address,

        [PSCredential]
        $Credential,

        [System.String]
        $LoginNameToRemove
    )

    Write-Host 'Example 7: Delete an iLO user account.'

    #create session
    $session = Connect-HPERedfish -Address $Address -Credential $Credential

    $accData = Get-HPERedfishDataRaw -odataid '/redfish/v1/AccountService/' -Session $session
    $accountsOdataId = $accData.Accounts.'@odata.id'

    $accounts = Get-HPERedfishDataRaw -odataid $accountsOdataId -Session $session
    $foundFlag = $false
    $requiredAccOdataId = ''
    foreach($accOdataId in $accounts.Members.'@odata.id')
    {
        $acc = Get-HPERedfishDataRaw -odataid $accOdataId -Session $session

        # If user to delete is found in user list, store the odataid for that user in $requiredAccOdataId variable
        if($acc.Username -eq $LoginNameToRemove)
        {
            $foundFlag = $true
            $requiredAccOdataId = $acc.'@odata.id'
            break
        }
    }
    if($foundFlag -eq $true)
    {
        # If the user was found, executet the HTTP DELETE method on the odataid of the user to be deleted.
        $ret = Remove-HPERedfishData -odataid $requiredAccOdataId -Session $session
        
        # process message(s) from Remove-HPERedfishData cmdlet
        if($ret.error.'@Message.ExtendedInfo'.Count -gt 0)
        {
            foreach($msgID in $ret.error.'@Message.ExtendedInfo')
            {
                $status = Get-HPERedfishMessage -MessageID $msgID.MessageID -MessageArg $msgID.MessageArgs -Session $session
                $status
            }
        }

        # print list of users. Deleted user will not be present in the list
        $accData = Get-HPERedfishDataRaw -odataid $accData.Accounts.'@odata.id' -Session $session
        foreach($mem in $accData.Members."@odata.id")
        {
            $memData = Get-HPERedfishDataRaw -odataid $mem -Session $session
            $memData
        }
    }
    else
    {
        Write-Error "$LoginNameToRemove not present"
    }

    # Disconnect session after use
    Disconnect-HPERedfish -Session $session
}
#Remove-iLOUserAccountExample7 -Address $Address -Credential $cred -LoginNameToRemove TimHorton

function Get-ActiveiLONICExample8
{
    param
    (
        [System.String]
        $Address,

        [PSCredential]
        $Credential
    )
    Write-Host 'Example 8: Retrieve active iLO NIC information'

    # create session
    $session = Connect-HPERedfish -Address $Address -Credential $Credential
    
    # retrieve manager list
    $managers = Get-HPERedfishDataRaw -odataid '/redfish/v1/Managers/' -Session $session
    foreach($manager in $managers.Members.'@odata.id')
    {
        # retrieve manager details and the ethernetNIC odataid from that
        $managerData = Get-HPERedfishDataRaw -odataid $manager -Session $session
        $nicURI = $managerData.EthernetInterfaces.'@odata.id'

        # retrieve all NIC information
        $nics = Get-HPERedfishDataRaw -odataid $nicURI -Session $session

        # print NIC details for enabled i.e. active NIC
        foreach($nic in $nics.Members.'@odata.id')
        {
            $nicData = Get-HPERedfishDataRaw -odataid $nic -Session $session
            if($nicData.Status.State -eq 'Enabled')
            {
                $nicData
            }
        }
    }

    # Disconnect session after use
    Disconnect-HPERedfish -Session $session
}
#Get-ActiveiLONICExample8 -Address $Address -Credential $cred

function Get-SessionExample9
{
    param
    (
        [System.String]
        $Address,

        [PSCredential]
        $Credential
    )
    Write-Host 'Example 9: Retrieve current session information'

    # connect session
    $session = Connect-HPERedfish -Address $Address -Credential $Credential

    # retrieve all sessions
    $sessions = Get-HPERedfishDataRaw -odataid '/redfish/v1/Sessionservice/' -Session $session
    
    #get the details of current session
    foreach($ses in $sessions.Sessions.'@odata.id')
    {
        $sesData = Get-HPERedfishDataRaw -odataid $ses -Session $session
        
        # for iLO 5
        $mySesOdataId = $sesData.Oem.Hpe.Links.MySession.'@odata.id'
        
        ## for iLO 4
        #$mySesOdataId = $sesData.Oem.Hp.Links.MySession.'@odata.id'

        foreach($mySes in $mySesOdataId)
        {
            $mySesData = Get-HPERedfishDataRaw $mySes -Session $session
            # for iLO 5
            if($mySesData.Oem.Hpe.MySession -eq $true)
            {
                $mySesData
                $mySesData.oem.hpe
            }

            ##for iLO 4
            #if($mySesData.Oem.Hp.MySession -eq $true)
            #{
            # $mySesData
            # $mySesData.oem.hp
            #}
        }
    }

    # disconnect session after use
    Disconnect-HPERedfish -Session $session
}
#Get-SessionExample9 -Address $Address -Credential $cred

function Set-UIDStateExample10
{
    param
    (
        [System.String]
        $Address,

        [PSCredential]
        $Credential,

        [ValidateSet('Lit','Off')]
        [System.String]
        $UIDState # Use 'Lit' or 'Off'. Value identified by 'IndicatorLED' field in 'redfish/v1/Systems/1'. The value 'Blinking' in mentioned in the schema is not settable by the user.
    )

    Write-Host 'Example 10: Change UID/IndicatorLED status'

    # connect session
    $session = Connect-HPERedfish -Address $Address -Credential $Credential
    
    # retrieve list of systems
    $systems = Get-HPERedfishDataRaw -odataid '/redfish/v1/Systems/' -Session $session
    foreach($sys in $systems.Members.'@odata.id')
    {
        # get the odataid of the system to PATCH the Indicator LED value
        $sysData = Get-HPERedfishDataRaw -odataid $sys -Session $session
        $sysURI = $sysData.'@odata.id'

        # create hashtable object to PATCH
        $UIDSetting = @{'IndicatorLED'=$UIDState}

        # PATCH the data using Set-HPERedfishData cmdlet
        $ret = Set-HPERedfishData -odataid $sysURI -Setting $UIDSetting -Session $session

        # process the message(s) from Set-HPERedfishData
        if($ret.error.'@Message.ExtendedInfo'.Count -gt 0)
        {
            foreach($msgID in $ret.error.'@Message.ExtendedInfo')
            {
                $status = Get-HPERedfishMessage -MessageID $msgID.MessageID -MessageArg $msgID.MessageArgs -Session $session
                $status
            }
        }
    }

    # Disconnect the session after use
    Disconnect-HPERedfish -Session $session
}
## NOTE: UID State - Unknown, Lit, Blinking, Off. Unknown and Blinking cannot be set by user
#Set-UIDStateExample10 -Address $Address -Credential $cred -UIDState 'Off'

function Get-ComputerSystemExample11
{
    param
    (
        [System.String]
        $Address,

        [PSCredential]
        $Credential
    )
    Write-Host 'Example 11: Retrieve information of computer systems'

    # connect session
    $session = Connect-HPERedfish -Address $Address -Credential $Credential
    
    # retrieve list of computer systems
    $systems = Get-HPERedfishDataRaw -odataid '/redfish/v1/Systems/' -Session $session

    # print details of all computer systems
    foreach($sys in $systems.Members.'@odata.id')
    {
        $sysData = Get-HPERedfishDataRaw -odataid $sys -Session $session
        $sysData
    }

    # Disconnect session after use
    Disconnect-HPERedfish -Session $session    
}
#Get-ComputerSystemExample11 -Address $Address -Credential $cred

function Set-VirutalMediaExample12
{
    param
    (
        [System.String]
        $Address,

        [PSCredential]
        $Credential,

        [System.Object]
        $IsoUrl = $null,

        [System.Object]
        $BootOnNextReset = $null
    )

    # NOTE: if ISO URL is blank and BootOnNextReset are blank/null, the virtual media is unmounted
    Write-Host 'Example 12 : Mount/Unmount virtual media DVD using URL'

    # Connect session
    $session = Connect-HPERedfish -Address $Address -Credential $Credential

    $managers = Get-HPERedfishDataRaw -odataid '/redfish/v1/Managers/' -Session $session
    foreach($mgr in $managers.Members.'@odata.id')
    {
        
        $mgrData = Get-HPERedfishDataRaw -odataid $mgr -Session $session
        # Check if virtual media is supported
        if($mgrData.PSObject.Properties.name -Contains 'VirtualMedia' -eq $false)
        {
            # If virtual media is not present in links under manager details, print error
            Write-Host 'Virtual media not available in Manager links'
        }
        else
        {
            
            $vmOdataId = $mgrData.VirtualMedia.'@odata.id'
            $vmData = Get-HPERedfishDataRaw -odataid $vmOdataId -Session $session
            foreach($vm in $vmData.Members.'@odata.id')
            {
                $data = Get-HPERedfishDataRaw -odataid $vm -Session $session
                # select the media option which contains DVD
                if($data.MediaTypes -contains 'DVD')
                {
                    # Create object to PATCH to update ISO image URI and to set
                    if($IsoUrl -eq $null)
                    {
                        $mountSetting = @{'Image'=$null}
                    }
                    else
                    {
                        $mountSetting = @{'Image'=[System.Convert]::ToString($IsoUrl)}
                    }
                    if($BootOnNextReset -ne $null -and $IsoUrl -ne $null)
                    {
                        # Create object to PATCH
                        # for iLO 5
                        $oem = @{'Hpe'=@{'BootOnNextServerReset'=[System.Convert]::ToBoolean($BootOnNextReset)}}
                        
                        ## for iLO 4
                        #$oem = @{'Hp'=@{'BootOnNextServerReset'=[System.Convert]::ToBoolean($BootOnNextReset)}}

                        $mountSetting.Add('Oem',$oem)
                    }
                    # PATCH the data to $vm odataid by using Set-HPERedfishData
                    #Disconnect-HPERedfish -Session $session
                    $ret = Set-HPERedfishData -odataid $vm -Setting $mountSetting -Session $session
                    
                    # Process message(s) returned from Set-HPERedfishData
                    if($ret.error.'@Message.ExtendedInfo'.Count -gt 0)
                    {
                        foreach($msgID in $ret.error.'@Message.ExtendedInfo')
                        {
                            $status = Get-HPERedfishMessage -MessageID $msgID.MessageID -MessageArg $msgID.MessageArgs -Session $session
                            $status
                        }
                    }
                    Get-HPERedfishDataRaw -odataid $vm -Session $session
                }
            }        
        }
    }
    # Disconnect session after use
    Disconnect-HPERedfish -Session $session
}
<#
# will return '(400) Bad Request' error if the virtual media is already in this state.
# IsoUrl = $null will dismount the virtual media. IsoUrl = '' will give 400 Bad Request error.
 
#unmount
Set-VirutalMediaExample12 -Address $Address -Credential $cred -IsoUrl $null -BootOnNextReset $false
 
#Mount
Set-VirutalMediaExample12 -Address $Address -Credential $cred -IsoUrl 'http://192.168.217.158/iso/Windows/en_windows_server_2012.iso' -BootOnNextReset $true
 
#unmount
Set-VirutalMediaExample12 -Address $Address -Credential $cred
#>


function Set-AssetTagExample13
{
    param
    (
        [System.String]
        $Address,

        [PSCredential]
        $Credential,

        [System.String]
        $AssetTag
    )
    Write-Host 'Example 13: Update AssetTag value.'

    # Connect sesion
    $session = Connect-HPERedfish -Address $Address -Credential $Credential
    
    # Retrieve list of systems
    $systems = Get-HPERedfishDataRaw -odataid '/redfish/v1/Systems/' -Session $session
    foreach($sys in $systems.Members.'@odata.id')
    {
        # Get each system odataid by first retrieving each system data and then extracting odataid from it
        $sysData = Get-HPERedfishDataRaw -odataid $sys -Session $session
        $sysOdataId = $sysData.'@odata.id'

        # Create hashtable object to PATCH to odataid of the system
        $assetTagSetting = @{'AssetTag'= $AssetTag}
        # PATCH data using Set-HPERedfishData cmdlet
        $ret = Set-HPERedfishData -odataid $sysOdataId -Setting $assetTagSetting -Session $session

        # Process message(s) from Set-HPERedfishData
        if($ret.error.'@Message.ExtendedInfo'.Count -gt 0)
        {
            foreach($msgID in $ret.error.'@Message.ExtendedInfo')
            {
                $status = Get-HPERedfishMessage -MessageID $msgID.MessageID -MessageArg $msgID.MessageArgs -Session $session
                $status
            }
        }
    }
    # Disconnect session after use
    Disconnect-HPERedfish -Session $session
}
#Set-AssetTagExample13 -Address $Address -Credential $cred -AssetTag 'TestAssetTag'

function Reset-iLOExample14
{
param
    (
        [System.String]
        $Address,

        [PSCredential]
        $Credential
    )

    Write-Host 'Example 14: Reset the iLO.'
    
    #create session
    $session = Connect-HPERedfish -Address $Address -Credential $Credential

    # Get list of managers
    $managers = Get-HPERedfishDataRaw -odataid '/redfish/v1/Managers/' -Session $session
    foreach($mgrOdataId in $managers.Members.'@odata.id') # /redfish/v1/managers/1/, /redfish/v1/managers/2/
    {
        # for possible operations on the manager check 'Actions' field in manager data
        $mgrData = Get-HPERedfishDataRaw -odataid $mgrOdataId -Session $session

        $resetTarget = $mgrData.Actions.'#Manager.Reset'.target

        #Since there is no other allowable values or options for iLO Reset, we do not provide -Data parameter value.
                
        # Send POST request using Invoke-HPERedfishAction
        $ret = Invoke-HPERedfishAction -odataid $resetTarget -Session $session
        Write-Host $ret.error
        # resetting iLO will delete all active sessions.

    }
    #automatically closes all connections
    #Disconnect-HPERedfish -Session $session
}
#Reset-iLOExample14 -Address $Address -Credential $cred

function Get-iLONICExample15
{
    param
    (
        [System.String]
        $Address,

        [PSCredential]
        $Credential,

        [ValidateSet('Active','Inactive','All')]
        [System.String]
        $NICState = 'Active'
    )
    Write-Host 'Example 15: Retrieve iLO NIC information'

    # Create Session
    $session = Connect-HPERedfish -Address $Address -Credential $Credential
    
    # Retrieve list of managers
    $managers = Get-HPERedfishDataRaw -odataid '/redfish/v1/Managers/' -Session $session
    foreach($manager in $managers.Members.'@odata.id')
    {
        # Retrieve manager data to extract Ethernet Interface odataid
        $managerData = Get-HPERedfishDataRaw -odataid $manager -Session $session
        $nicOdataId = $managerData.EthernetInterfaces.'@odata.id'

        # Retrieve ethernet NIC details
        $nics = Get-HPERedfishDataRaw -odataid $nicOdataId -Session $session

        # Display NIC accoring to the NICState parameter
        foreach($nicMemberOdataId in $nics.Members.'@odata.id')
        {
            $nicData = Get-HPERedfishDataRaw -odataid $nicMemberOdataId -Session $session
            if($nicData.Status.State -eq 'Enabled')
            {
                if($NICState -eq 'Active')
                {
                    $nicData
                    break
                }
                if($NICState -eq 'All')
                {
                    $nicData
                }
            }
            if($nicData.Status.State -eq 'Disabled')
            {
                if($NICState -eq 'Inactive')
                {
                    $nicData
                    break
                }
                if($NICState -eq 'All')
                {
                    $nicData
                }
            }
        }
    }
    # Disconnect the session after use
    Disconnect-HPERedfish -Session $session
}
#Get-iLONICExample15 -Address $Address -Credential $cred -NICState 'Active'

function Set-ActiveiLONICExample16
{
    param
    (
        [System.String]
        $Address,

        [PSCredential]
        $Credential,

        [Boolean]
        $SharedNIC = $false
    )
    Write-Host 'Example 16: Set the active iLO NIC'

    # Create session
    $session = Connect-HPERedfish -Address $Address -Credential $Credential
    
    # Retrieve list of managers
    $managers = Get-HPERedfishDataRaw -odataid '/redfish/v1/Managers/' -Session $session
    foreach($manager in $managers.Members.'@odata.id')
    {
        
        $managerData = Get-HPERedfishDataRaw -odataid $manager -Session $session
        $nicsOdataId = $managerData.EthernetInterfaces.'@odata.id'
        $nics = Get-HPERedfishDataRaw -odataid $nicsOdataId -Session $session
        $selectedNICOdataId = ''
        foreach($nic in $nics.Members.'@odata.id')
        {
            $nicData = Get-HPERedfishDataRaw -odataid $nic -Session $session
            if($SharedNIC -eq $true)
            {
                # if a shared NIC setting is required, then check for LOM or Flexible LOM select URI where LOM/FlexLOM is present
                if($nicData.Oem.hpe.SupportsFlexibleLOM -eq $null -and $nicData.Oem.hpe.SupportsLOM -eq $null)
                {
                    continue;
                }
                else
                {
                    if($nicData.Oem.hpe.SupportsFlexibleLOM -eq $true)
                    {
                        $selectedNICOdataId = $nicData.'@odata.id'
                        break
                    }
                    elseif($nicData.Oem.hpe.SupportsLOM -eq $true)
                    {
                        $selectedNICOdataId = $nicData.'@odata.id'
                        break
                    }
                    else
                    {
                        Write-Host 'Shared NIC not supported.'
                    }
                }
            }
            else #if sharedNic set to false, select the odataid of NIC where LOM/FlexLOM are not present
            {
                if($nicData.Oem.hpe.SupportsFlexibleLOM -eq $null -and $nicData.Oem.hpe.SupportsLOM -eq $null)
                {
                    $selectedNICOdataId = $nicData.'@odata.id'
                    break
                }
            }
            
            ## for iLO 4
            <#
            if($SharedNIC -eq $true)
            {
                # if a shared NIC setting is required, then check for LOM or Flexible LOM select URI where LOM/FlexLOM is present
                if($nicData.Oem.hp.SupportsFlexibleLOM -eq $null -and $nicData.Oem.hp.SupportsLOM -eq $null)
                {
                    continue;
                }
                else
                {
                    if($nicData.Oem.hp.SupportsFlexibleLOM -eq $true)
                    {
                        $selectedNICOdataId = $nicData.'@odata.id'
                        break
                    }
                    elseif($nicData.Oem.hp.SupportsLOM -eq $true)
                    {
                        $selectedNICOdataId = $nicData.'@odata.id'
                        break
                    }
                    else
                    {
                        Write-Host 'Shared NIC not supported.'
                    }
                }
            }
            else #if sharedNic set to false, select the odataid of NIC where LOM/FlexLOM are not present
            {
                if($nicData.Oem.hp.SupportsFlexibleLOM -eq $null -and $nicData.Oem.hp.SupportsLOM -eq $null)
                {
                    $selectedNICOdataId = $nicData.'@odata.id'
                    break
                }
            }
            #>

        }

        if($selectedNICOdataId -ne '')
        {
            # for iLO 5
            $req = @{'Oem'=@{'Hpe'=@{'NICEnabled' = $true}}}
            
            ## for iLO 4
            #$req = @{'Oem'=@{'Hp'=@{'NICEnabled' = $true}}}

            $ret = Set-HPERedfishData -odataid $selectedNICOdataId -Setting $req -Session $session

            # Process message(s) returned from Set-HPERedfishData cmdlet
            if($ret.error.'@Message.ExtendedInfo'.Count -gt 0)
            {
                foreach($msgID in $ret.error.'@Message.ExtendedInfo')
                {
                    $status = Get-HPERedfishMessage -MessageID $msgID.MessageID -MessageArg $msgID.MessageArgs -Session $session
                    $status
                }
            }
        }
    }

    # Disconnect the session after use
    Disconnect-HPERedfish -Session $session
}
#Set-ActiveiLONICExample16 -Address $Address -Credential $cred

function Get-IMLExample17
{
    param
    (
        [System.String]
        $Address,

        [PSCredential]
        $Credential
    )
    Write-Host 'Example 17: Retrieve Integrated Management Log (IML)'

    # Create session
    $session = Connect-HPERedfish -Address $Address -Credential $Credential
    
    # Retrieve systems list
    $systems = Get-HPERedfishDataRaw -odataid '/redfish/v1/systems/' -Session $session
    foreach($sys in $systems.Members.'@odata.id')
    {
        # Check if logs are available
        $systemData = Get-HPERedfishDataRaw -odataid $sys -Session $session
        if($systemData.PSObject.properties.name -notcontains 'LogServices')
        {
            Write-Host 'Logs not available'
        }
        else
        {
            # Retrieve the IML odataid
            $logServicesOdataId = $systemData.LogServices.'@odata.id'
            $logServicesData = Get-HPERedfishDataRaw -odataid $logServicesOdataId -Session $session
            $imlOdataId = ''
            foreach($link in $logServicesData.Members.'@odata.id')
            {
                $spl = $link.split('`/')
                if($spl[$spl.length-2] -match 'IML')
                {
                    $imlOdataId = $link
                    break
                }
            }

            # retrieve and display IML log entries
            $imlData = Get-HPERedfishDataRaw -odataid $imlOdataId -Session $session
            foreach($entryOdataId in $imlData.Entries.'@odata.id')
            {
                $entries = Get-HPERedfishDataRaw -odataid $entryOdataId -Session $session
                foreach($entryOdataId in $entries.Members.'@odata.id')
                {
                    $imlEntry = Get-HPERedfishDataRaw -odataid $entryOdataId -Session $session
                    $imlEntry
                }
            }
        }
    }
    # Disconnect the session after use
    Disconnect-HPERedfish -Session $session
}
#Get-IMLExample17 -Address $Address -Credential $cred

function Get-iLOEventLogExample18
{
    param
    (
        [System.String]
        $Address,

        [PSCredential]
        $Credential
    )
    Write-Host 'Example 18: Retrieve iLO Event Log'

    # Create session
    $session = Connect-HPERedfish -Address $Address -Credential $Credential
    $managers = Get-HPERedfishDataRaw -odataid '/redfish/v1/managers/' -Session $session
    foreach($mgr in $managers.Members.'@odata.id')
    {
        $managerData = Get-HPERedfishDataRaw -odataid $mgr -Session $session
        if($managerData.PSObject.properties.name -notcontains 'LogServices')
        {
            Write-Host 'Logs not available'
        }
        else
        {
            # get the odataid for iLO event logs
            $logServicesOdataId = $managerData.LogServices.'@odata.id'
            $logServicesData = Get-HPERedfishDataRaw -odataid $logServicesOdataId -Session $session
            $ielOdataId = ''
            foreach($link in $logServicesData.Members.'@odata.id')
            {
                $spl = $link.split('`/')
                if($spl[$spl.length-2] -match 'IEL')
                {
                    $ielOdataId = $link
                    break
                }
            }

            # Retrieve and display the log entries
            $ielData = Get-HPERedfishDataRaw -odataid $ielOdataId -Session $session
            foreach($entryOdataId in $ielData.Entries.'@odata.id')
            {
                $entries = Get-HPERedfishDataRaw -odataid $entryOdataId -Session $session
                foreach($entryOdataId in $entries.Members.'@odata.id')
                {
                    $ielEntry = Get-HPERedfishDataRaw -odataid $entryOdataId -Session $session
                    $ielEntry
                }
            }
        }
    }
    # Disconnect the session after use
    Disconnect-HPERedfish -Session $session
}
#Get-iLOEventLogExample18 -Address $Address -Credential $cred

function Clear-IMLExample19
{
    param
    (
        [System.String]
        $Address,

        [PSCredential]
        $Credential
    )
    Write-Host 'Example 19: Clear Integrated Management Log'

    # Create session
    $session = Connect-HPERedfish -Address $Address -Credential $Credential
    
    #remember system list
    $systems = Get-HPERedfishDataRaw -odataid '/redfish/v1/systems/' -Session $session
    foreach($sys in $systems.Members.'@odata.id')
    {
        # check if logs are available or not
        $systemData = Get-HPERedfishDataRaw -odataid $sys -Session $session
        if($systemData.PSObject.properties.name -notcontains 'LogServices')
        {
            Write-Host 'Logs not available'
        }
        else
        {
            # extract odataid for IML
            $logServicesOdataId = $systemData.LogServices.'@odata.id'
            $logServicesData = Get-HPERedfishDataRaw -odataid $logServicesOdataId -Session $session
            $requiredImlOdataId = ''
            foreach($link in $logServicesData.Members.'@odata.id')
            {
                $spl = $link.split('`/')
                if($spl[$spl.length-2] -match 'IML')
                {
                    $requiredImlOdataId = $link
                    break
                }
            }
            
            # retrieve the target odataid where the POST request is to be sent
            $imlData = Get-HPERedfishDataRaw -odataid $requiredImlOdataId -Session $session
            $clearImlTarget = $imlData.Actions.'#LogService.ClearLog'.target

            #Since there is no property other than 'target' under the 'Action' property, -Data parameter is not required.
            # Send the POST request using Invoke-HPERedfishAction cmdlet
            $ret = Invoke-HPERedfishAction -odataid $clearImlTarget -Session $session

            # Process message(s) returned from Invoke-HPERedfishAction cmdlet
            if($ret.error.'@Message.ExtendedInfo'.Count -gt 0)
            {
                foreach($msgID in $ret.error.'@Message.ExtendedInfo')
                {
                    $status = Get-HPERedfishMessage -MessageID $msgID.MessageID -MessageArg $msgID.MessageArgs -Session $session
                    $status
                }
            }
        }
    }

    # Disconnect the session after use
    Disconnect-HPERedfish -Session $session
}
<#
Clear-IMLExample19 -Address $Address -Credential $cred
Get-IMLExample17 -Address $Address -Credential $cred
#>


function Clear-iLOEventLogExample20
{
    param
    (
        [System.String]
        $Address,

        [PSCredential]
        $Credential
    )
    Write-Host 'Example 20: Clear iLO Event Log'

    # Create session
    $session = Connect-HPERedfish -Address $Address -Credential $Credential
    
    # Retrieve manager list
    $managers = Get-HPERedfishDataRaw -odataid '/redfish/v1/managers/' -Session $session
    foreach($mgr in $managers.Members.'@odata.id')
    {
        $managerData = Get-HPERedfishDataRaw -odataid $mgr -Session $session
        # check if logs are available or not
        if($managerData.PSObject.properties.name -notcontains 'LogServices')
        {
            Write-Host 'Logs not available'
        }
        else
        {
            # get the odataid for iLO event logs
            $logServicesOdataId = $managerData.LogServices.'@odata.id'
            $logServicesData = Get-HPERedfishDataRaw -odataid $logServicesOdataId -Session $session
            $requiredIelOdataId = ''
            foreach($link in $logServicesData.Members.'@odata.id')
            {
                $spl = $link.split('`/')
                if($spl[$spl.length-2] -match 'IEL')
                {
                    $requiredIelOdataId = $link
                    break
                }
            }

            # retrieve the target odataid where the POST request is to be sent
            $ielData = Get-HPERedfishDataRaw -odataid $requiredIelOdataId -Session $session
            $clearIelTarget = $ielData.Actions.'#LogService.ClearLog'.target

            #Since there is no property other than 'target' under the 'Action' property, -Data parameter is not required
            # Send the POST request using Invoke-HPERedfishAction cmdlet
            $ret = Invoke-HPERedfishAction -odataid $clearIelTarget -Session $session

            # Process message(s) returned from Invoke-HPERedfishAction cmdlet
            if($ret.error.'@Message.ExtendedInfo'.Count -gt 0)
            {
                foreach($msgID in $ret.error.'@Message.ExtendedInfo')
                {
                    $status = Get-HPERedfishMessage -MessageID $msgID.MessageID -MessageArg $msgID.MessageArgs -Session $session
                    $status
                }
            }
        }
    }

    # Disconnect the session after use
    Disconnect-HPERedfish -Session $session
}
<#
Clear-iLOEventLogExample20 -Address $Address -Credential $cred
Get-iLOEventLogExample18 -Address $Address -Credential $cred
#>


function Set-SNMPExample21
{
    param
    (
        [System.String]
        $Address,

        [PSCredential]
        $Credential,

        [System.String]
        $Mode, # Agentless or Passthru

        [System.Object]
        $AlertsEnabled = $null #use true or false only


    )
    Write-Host 'Example 21: Configure iLO SNMP settings.'

    # Create session
    $session = Connect-HPERedfish -Address $Address -Credential $Credential
    
    # retrieve list of managers
    $managers = Get-HPERedfishDataRaw -odataid '/redfish/v1/Managers/' -Session $session
    foreach($mgr in $managers.Members.'@odata.id')
    {
        # retrieve settings of NetworkService data
        $mgrData = Get-HPERedfishDataRaw -odataid $mgr -Session $session
        $netSerOdataId = $mgrData.NetworkProtocol.'@odata.id'
        $netSerData = Get-HPERedfishDataRaw -odataid $netSerOdataId -Session $session
        
        if($netSerData.Oem.Hp.Links.PSObject.properties.name -notcontains 'SNMPService')
        {
            Write-Host 'SNMP services not available in Manager Network Service'
        }
        else
        {
            $snmpSerOdataId = $netSerData.Oem.Hp.Links.SNMPService.'@odata.id'
            
            $snmpSerData = Get-HPERedfishDataRaw -odataid $snmpSerOdataId -Session $session

            # create hashtable object according to the parameters provided by user
            $snmpSetting = @{}
            if($mode -ne '' -and $Mode -ne $null)
            {
                $snmpSetting.Add('Mode',$Mode)
            }
            if($AlertsEnabled -ne $null)
            {
                $snmpSetting.Add('AlertsEnabled',[System.Convert]::ToBoolean($AlertsEnabled))
            }

            # PATCh the settings using Set-HPERedfishData cmdlet
            $ret = Set-HPERedfishData -odataid $snmpSerOdataId -Setting $snmpSetting -Session $session

            # Process message(s) returned from Set-HPERedfishData cmdlet
            if($ret.error.'@Message.ExtendedInfo'.Count -gt 0)
            {
                foreach($msgID in $ret.error.'@Message.ExtendedInfo')
                {
                    $status = Get-HPERedfishMessage -MessageID $msgID.MessageID -MessageArg $msgID.MessageArgs -Session $session
                    $status
                }
            }
        }
    }
    # Disconnect the session after use
    Disconnect-HPERedfish -Session $session
}
## This example is for iLO 4 only.
#Set-SNMPExample21 -Address $Address -Credential $cred -Mode Agentless -AlertsEnabled $false
 
function Get-SchemaExample22
{
    param
    (
        [System.String]
        $Address,

        [PSCredential]
        $Credential,

        [System.String]
        $odatatype,

        [ValidateSet('en','jp','zh')]
        [System.String]
        $Language = 'en'


    )

    Write-Host 'Example 22: Retrieve schema'

    # Create session
    $session = Connect-HPERedfish -Address $Address -Credential $Credential
    
    # Retrieve the schema with the odatatype provided by the user
    $sch = Get-HPERedfishSchema -odatatype $odatatype -Language $Language -Session $session
    $sch.properties
    
    # Disconnect the session after use
    Disconnect-HPERedfish -Session $session

}
#Get-SchemaExample22 -Address $Address -Credential $cred -odatatype ComputerSystem

function Get-RegistryExample23
{
    param
    (
        [System.String]
        $Address,

        [PSCredential]
        $Credential,

        [System.String]
        $RegistryPrefix,

        [System.String]
        $Language = 'en'


    )

    Write-Host 'Example 23: Retrieve registry'

    # Create session
    $session = Connect-HPERedfish -Address $Address -Credential $Credential
    
    # retrieve list of registries
    $reg = Get-HPERedfishDataRaw -odataid '/redfish/v1/registries/' -Session $session

    # select the registry where the prefix is same as value provided by user in 'RegistryPrefix' parameter
    $reqRegMembers = $reg.Members.'@odata.id' #| ? {$_.Schema.ToString().IndexOf($RegistryPrefix) -eq 0}
    
    # retrieve and display the external reference for the required language
    foreach($reqRegOdataId in $reqRegMembers)
    {
        $reqReg = Get-HPERedfishDataRaw -odataid $reqRegOdataId -Session $session

        # for iLO 5
        $reqRegURI = ($reqReg.Location|?{$_.Language -eq $Language}).uri

        ## for iLO 4
        #$reqRegURI = ($reqReg.Location|?{$_.Language -eq $Language}).uri.extref

        $reqRegData = Get-HPERedfishDataRaw -odataid $reqRegURI -Session $session
        $reqRegData
    }
    # Disconnect the session after use
    Disconnect-HPERedfish -Session $session

}
#Get-RegistryExample23 -Address $Address -Credential $cred -RegistryPrefix $registryPrefix

function Set-TimeZoneExample24
{
    param
    (
        [System.String]
        $Address,

        [PSCredential]
        $Credential,

        [System.String]
        $TimeZone
    )

    #NOTE: This will work only if iLO is NOT configured to take time settings from DHCP v4 or v6. Otherwise, error 400 - bad request is thrown.
    Write-Host 'Example 24: Set timezone'

    # Create session
    $session = Connect-HPERedfish -Address $Address -Credential $Credential
    
    # retrieve manager list
    $managers = Get-HPERedfishDataRaw -odataid '/redfish/v1/managers/' -Session $session
    foreach($mgr in $managers.Members.'@odata.id')
    {
        # Retrieve DateTimeService odataid and then retrieve the timezone name to display to user
        $mgrData = Get-HPERedfishDataRaw -odataid $mgr -Session $session
        $dtsOdataId = $mgrData.Oem.Hp.Links.DateTimeService.'@odata.id'
        $dtsData = Get-HPERedfishDataRaw -odataid $dtsOdataId -Session $session
        $currTimeZone = $dtsData.TimeZone.Name
        Write-Host "Current timezone $currTimeZone"

        # from list of all timezone, first check if the user entered value is present in this list.
        foreach($tz in $dtsData.TimeZoneList)
        {
            if($tz.Name -eq $TimeZone)
            {
                # User entered timezone value is present.
                # Create timezone hashtable object to PATCH
                $setting = @{'TimeZone'=@{'Name'=$tz.name}}
                
                # PATCH the new setting using Set-HPERedfishData cmdlet
                $ret = Set-HPERedfishData -odataid $dtsOdataId -Setting $setting -Session $session

                # Process message(s) returned from Set-HPERedfishData cmdlet
                if($ret.error.'@Message.ExtendedInfo'.Count -gt 0)
                {
                    foreach($msgID in $ret.error.'@Message.ExtendedInfo')
                    {
                        $status = Get-HPERedfishMessage -MessageID $msgID.MessageID -MessageArg $msgID.MessageArgs -Session $session
                        $status
                    }
                }
                break
            }
        }
    }

    # Disconnect the session after use
    Disconnect-HPERedfish -Session $session
}
## Patch using Timezone name is preferred over timezone index. If both are patched, Index field will be ignored
## DHCPv4 should be disabled in active NIC for setting the timezone
#Set-TimeZoneExample24 -Address $Address -Credential $cred -TimeZone 'America/Chicago'

function Set-iLONTPServerExample25
{
    param
    (
        [System.String]
        $Address,

        [PSCredential]
        $Credential,

        [System.Array]
        $StaticNTPServer
    )

    #NOTE: This will work only if iLO is NOT configured to take time settings from DHCP v4 or v6. Otherwise, error 400 - bad request is thrown.
    Write-Host 'Example 25: Set NTP server'

    # Create session
    $session = Connect-HPERedfish -Address $Address -Credential $Credential
    
    # Retrieve manager list
    $managers = Get-HPERedfishDataRaw -odataid '/redfish/v1/managers/' -Session $session
    foreach($mgr in $managers.Members.'@odata.id')
    {
        # retrieve date time details and display current values
        $mgrData = Get-HPERedfishDataRaw -odataid $mgr -Session $session
        $dtsOdataId = $mgrData.Oem.Hp.Links.DateTimeService.'@odata.id'
        $dtsData = Get-HPERedfishDataRaw -odataid $dtsOdataId -Session $session
        Write-Host Current iLO Date and Time setting - $dtsData.ConfigurationSettings
        Write-Host Current iLO NTP Servers - $dtsData.NTPServers

        # Create hashtable object with values for NTPServer
        $setting = @{'StaticNTPServers'=$StaticNTPServer}

        # PATCH new NTPServer data using Set-HPERedfishData
        $ret = Set-HPERedfishData -odataid $dtsOdataId -Setting $setting -Session $session

        # Process message(s) returned from Set-HPERedfishData cmdlet
        if($ret.error.'@Message.ExtendedInfo'.Count -gt 0)
        {
            foreach($msgID in $ret.error.'@Message.ExtendedInfo')
            {
                $status = Get-HPERedfishMessage -MessageID $msgID.MessageID -MessageArg $msgID.MessageArgs -Session $session
                $status
            }
        }
    }

    # Disconnect the session after use
    Disconnect-HPERedfish -Session $session
}
## DHCPv4 should be disabled in active NIC for setting the StaticNTPServer
#Set-iLONTPServerExample25 -Address $Address -Credential $cred -StaticNTPServer @('192.168.0.1','192.168.0.2')

function Get-PowerMetricExample26
{
    param
    (
        [System.String]
        $Address,

        [PSCredential]
        $Credential
    )

    #NOTE: This will work only if iLO is NOT configured to take time settings from DHCP v4 or v6
    Write-Host 'Example 26: Retrieve PowerMetrics average watts'

    # Create session
    $session = Connect-HPERedfish -Address $Address -Credential $Credential
    
    # retrieve chassis list
    $chassis = Get-HPERedfishDataRaw -odataid '/redfish/v1/chassis/' -Session $session
    foreach($cha in $chassis.Members.'@odata.id')
    {
        # get PowerMetrics odataid, retrieve the data and display
        $chaData = Get-HPERedfishDataRaw -odataid $cha -Session $session
        $powerOdataId = $chaData.Power.'@odata.id'
        $powerData = Get-HPERedfishDataRaw -odataid $powerOdataId -Session $session
        foreach($PowerControl in $powerData.PowerControl)
        {
            Write-Host "$($chaData.Model) AverageConsumedWatts = $($PowerControl.PowerMetrics.AverageConsumedWatts) watts over a $($PowerControl.PowerMetrics.IntervalInMin) minute moving average"
        }
    }

    # Disconnect the session after use
    Disconnect-HPERedfish -Session $session
}
#Get-PowerMetricExample26 -Address $Address -Credential $cred


function Get-ThermalMetricsExample27
{
    param
    (
        [System.String]
        $Address,

        [PSCredential]
        $Credential
    )

    Write-Host 'Example 27: Get Temperature and Fan details from Thermal Metrics.'
    
    #create session
    $session = Connect-HPERedfish -Address $Address -Credential $Credential

    #retrieve Chassis list
    $chassisList = Get-HPERedfishDataRaw -odataid '/redfish/v1/chassis/' -Session $session
    foreach($chassisOdataId in $chassisList.Members.'@odata.id')
    {
        $chasisData = Get-HPERedfishDataRaw -odataid $ChassisOdataId -Session $session
        
        # get the thermal metrics of the chassis
        $thermalData = Get-HPERedfishDataRaw -odataid $chasisData.Thermal.'@odata.id' -Session $session
        
        # display temperature values
        Write-Host "Temperature: "
        $temps = $thermalData.Temperatures
        $temps
        
        # display fan values
        Write-Host "Fans: "
        $fans = $thermalData.Fans
        $fans
    }
    Disconnect-HPERedfish -Session $session
}
#Get-ThermalMetricsExample27 -Address $Address -Credential $cred
Enable-HPERedfishCertificateAuthentication


# SIG # Begin signature block
# MIIjqAYJKoZIhvcNAQcCoIIjmTCCI5UCAQExDzANBglghkgBZQMEAgEFADB5Bgor
# BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYC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