Invoke-SupportAssistCollectionLocalREDFISH.psm1
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 |
<#
_author_ = Texas Roemer <Texas_Roemer@Dell.com> _version_ = 4.0 Copyright (c) 2020, Dell, Inc. This software is licensed to you under the GNU General Public License, version 2 (GPLv2). There is NO WARRANTY for this software, express or implied, including the implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2 along with this software; if not, see http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt #> <# .Synopsis Cmdlet using Redfish with OEM extension to either get Support Assist (SA) license agreement info, accept end user license agreement (EULA), register SA or perform SA collection locally. NOTE: Before you perform SA local collection, the EULA must be accepted. .DESCRIPTION Cmdlet using Redfish with OEM extension to either get Support Assist (SA) license agreement info, accept end user license agreement (EULA), register SA or perform SA collection locally. NOTE: Before you perform SA local collection, the EULA must be accepted. Supported parameters to pass in for cmdlet: - idrac_ip: Pass in iDRAC IP - idrac_username: Pass in iDRAC username - idrac_password: Pass in iDRAC password - get_SA_licence_agreement_info: Pass in "y" to get Support Assist license and registered current status. - accept_SA_license_agreement: Pass in "y" to accept Support Assist end user license agreement (EULA) - register_SA: Pass in "y" to register Support Assist Collection iDRAC feature. NOTE: You must also pass in city, company name, country, email, first name, last name, phone number, street, state and zip arguments to register. NOTE: iDRAC Service Module (iSM) must be installed and service running on the operating system before you register SA. - city: Pass in city name to register Support Assist. If passing in a value with whitespace, make sure to surround the value with double quotes. - companyname: Pass in company name to register Support Assist. If passing in a value with whitespace, make sure to surround the value with double quotes. - country: Pass in country to register Support Assist. If passing in a value with whitespace, make sure to surround the value with double quotes. - email: Pass in email to register Support Assist - firstname: Pass in first name to register Support Assist - lastname: Pass in last name to register Support Assist - phonenumber: Pass in phone number to register Support Assist - street: Pass in street name to register Support Assist. If passing in a value with whitespace, make sure to surround the value with double quotes. - state: Pass in state to register Support Assist - zip: Pass in zip code to register Support Assist - execute_SA_collection: Perform Support Assist collection locally, Pass in a value for the type of data you want to collect for Support Assist collection. Supported values are: "0" for DebugLogs, "1" for HWData, "2" for OSAppData or "3" for TTYLogs. Note: You can pass in one value or multiple values to collect. If you pass in multiple values, use comma separator for the values and surround it with double quotes (Example: "0,3") .EXAMPLE Invoke-SupportAssistCollectionLocalREDFISH -idrac_ip 192.168.0.120 -idrac_username root -idrac_password calvin -get_SA_license_agreement_info y # This example will get iDRAC Support Assist license and register status .EXAMPLE Invoke-SupportAssistCollectionLocalREDFISH -idrac_ip 192.168.0.120 -idrac_username root -idrac_password calvin -accept_SA_license_agreement y # This example will accept Support Assist license agreement .EXAMPLE Invoke-SupportAssistCollectionLocalREDFISH -idrac_ip 192.168.0.120 -idrac_username root -idrac_password calvin -register_SA y -city Austin -companyname Dell -country US -email test@dell.com -firstname User -lastname Tester -phonenumber 512-111-5555 -street "511 street name" -state Texas -zip 78758 # This example will register Support Assist feature for iDRAC .EXAMPLE Invoke-SupportAssistCollectionLocalREDFISH -idrac_ip 192.168.0.120 -idrac_username root -idrac_password calvin -execute_SA_collection "1,3" # This example will execute Support Assist collection locally capturing hardware data and storage logs. Once the job is marked completed, cmdlet will prompt user to download the Support Assist collection zip file. #> function Invoke-SupportAssistCollectionLocalREDFISH { # Required, optional parameters needed to be passed in when cmdlet is executed param( [Parameter(Mandatory=$True)] [string]$idrac_ip, [Parameter(Mandatory=$True)] [string]$idrac_username, [Parameter(Mandatory=$True)] [string]$idrac_password, [Parameter(Mandatory=$False)] [string]$get_SA_license_agreement_info, [Parameter(Mandatory=$False)] [string]$accept_SA_license_agreement, [Parameter(Mandatory=$False)] [string]$register_SA, [Parameter(Mandatory=$False)] [string]$city, [Parameter(Mandatory=$False)] [string]$companyname, [Parameter(Mandatory=$False)] [string]$country, [Parameter(Mandatory=$False)] [string]$email, [Parameter(Mandatory=$False)] [string]$firstname, [Parameter(Mandatory=$False)] [string]$lastname, [Parameter(Mandatory=$False)] [string]$phonenumber, [Parameter(Mandatory=$False)] [string]$street, [Parameter(Mandatory=$False)] [string]$state, [Parameter(Mandatory=$False)] [string]$zip, [Parameter(Mandatory=$False)] [string]$execute_SA_collection ) # Function to ignore SSL certs function Ignore-SSLCertificates { $Provider = New-Object Microsoft.CSharp.CSharpCodeProvider $Compiler = $Provider.CreateCompiler() $Params = New-Object System.CodeDom.Compiler.CompilerParameters $Params.GenerateExecutable = $false $Params.GenerateInMemory = $true $Params.IncludeDebugInformation = $false $Params.ReferencedAssemblies.Add("System.DLL") > $null $TASource=@' namespace Local.ToolkitExtensions.Net.CertificatePolicy { public class TrustAll : System.Net.ICertificatePolicy { public bool CheckValidationResult(System.Net.ServicePoint sp,System.Security.Cryptography.X509Certificates.X509Certificate cert, System.Net.WebRequest req, int problem) { return true; } } } '@ $TAResults=$Provider.CompileAssemblyFromSource($Params,$TASource) $TAAssembly=$TAResults.CompiledAssembly $TrustAll = $TAAssembly.CreateInstance("Local.ToolkitExtensions.Net.CertificatePolicy.TrustAll") [System.Net.ServicePointManager]::CertificatePolicy = $TrustAll } # Function to set up iDRAC credentials function setup_idrac_creds { [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::TLS12 $user = $idrac_username $pass= $idrac_password $secpasswd = ConvertTo-SecureString $pass -AsPlainText -Force $global:credential = New-Object System.Management.Automation.PSCredential($user, $secpasswd) } # Function to get Powershell version function get_powershell_version { $get_host_info = Get-Host $major_number = $get_host_info.Version.Major $global:get_powershell_version = $major_number } # Function Get Support Assist current license agreement information function get_support_assist_license_agreement { Write-Host "`n- Current Support Assist End User License Agreement Information -`n" $JsonBody = @{} | ConvertTo-Json -Compress $uri = "https://$idrac_ip/redfish/v1/Dell/Managers/iDRAC.Embedded.1/DellLCService/Actions/DellLCService.SupportAssistGetEULAStatus" try { if ($global:get_powershell_version -gt 5) { $post_result = Invoke-WebRequest -UseBasicParsing -SkipHeaderValidation -SkipCertificateCheck -Uri $uri -Credential $credential -Body $JsonBody -Method Post -ContentType 'application/json' -Headers @{"Accept"="application/json"} -ErrorVariable RespErr } else { Ignore-SSLCertificates $post_result = Invoke-WebRequest -UseBasicParsing -Uri $uri -Credential $credential -Method Post -ContentType 'application/json' -Headers @{"Accept"="application/json"} -Body $JsonBody -ErrorVariable RespErr } } catch { Write-Host $RespErr break } if ($post_result.StatusCode -eq 200) { } else { [String]::Format("- FAIL, POST command failed to GET SA license info, statuscode {0} returned. Detail error message: {1}",$post_result.StatusCode, $post_result) break } $post_result = $post_result.Content | ConvertFrom-Json $post_result_final = $post_result $register_status = $post_result_final.IsRegistered $get_key = "@Message.ExtendedInfo" if ($post_result_final.$get_key.Message[0].Contains("License") -or $post_result_final.$get_key.Message[0].Contains("license")) { $license_message = $post_result_final.$get_key.Message[0] Write-Host "IsRegistered : $register_status" Write-Host "LicenseStatus : $license_message" } else { $license_message = $post_result_final.$get_key.Message[1] Write-Host "IsRegistered : $register_status" Write-Host "LicenseStatus : $license_message" } } # Function accept support assist license agreement function accept_support_assist_license_agreement { $JsonBody = @{} | ConvertTo-Json -Compress $uri = "https://$idrac_ip/redfish/v1/Dell/Managers/iDRAC.Embedded.1/DellLCService/Actions/DellLCService.SupportAssistAcceptEULA" try { if ($global:get_powershell_version -gt 5) { $post_result = Invoke-WebRequest -UseBasicParsing -SkipHeaderValidation -SkipCertificateCheck -Uri $uri -Credential $credential -Body $JsonBody -Method Post -ContentType 'application/json' -Headers @{"Accept"="application/json"} -ErrorVariable RespErr } else { Ignore-SSLCertificates $post_result = Invoke-WebRequest -UseBasicParsing -Uri $uri -Credential $credential -Method Post -ContentType 'application/json' -Headers @{"Accept"="application/json"} -Body $JsonBody -ErrorVariable RespErr } } catch { Write-Host $RespErr break } if ($post_result.StatusCode -eq 200 -or $post_result.StatusCode -eq 202) { Write-Host "`n- PASS, POST command passed to accept Support Assist license agreement (EULA)`n" } else { [String]::Format("- FAIL, POST command failed to accept SA license, statuscode {0} returned. Detail error message: {1}",$post_result.StatusCode, $post_result) break } } # Function to register Support Assist feature function register_support_assist_feature { # Check if iSM is installed and running in the OS $uri = "https://$idrac_ip/redfish/v1/Managers/iDRAC.Embedded.1/Attributes" try { if ($global:get_powershell_version -gt 5) { $result = Invoke-WebRequest -SkipCertificateCheck -SkipHeaderValidation -Uri $uri -Credential $credential -Method Get -UseBasicParsing -ErrorVariable RespErr -Headers @{"Accept"="application/json"} } else { Ignore-SSLCertificates $result = Invoke-WebRequest -Uri $uri -Credential $credential -Method Get -UseBasicParsing -ErrorVariable RespErr -Headers @{"Accept"="application/json"} } } catch { Write-Host $RespErr break } $get_all_attributes=$result.Content | ConvertFrom-Json | Select Attributes $get_iSM_running_status = $get_all_attributes.Attributes | Select "ServiceModule.1.ServiceModuleState" $get_OS_BMC_state = $get_all_attributes.Attributes | Select "OS-BMC.1.AdminState" $attribute_name = "ServiceModule.1.ServiceModuleState" if ($get_iSM_running_status.$attribute_name -eq "Not Running") { Write-Host "`n- WARNING, iDRAC Service Module(iSM) is either not installed or service is not running in the Operating System" break } # iDRAC attribute OS-BMC admin state must be enabled to register iSM $attribute_name = "OS-BMC.1.AdminState" if ($get_OS_BMC_state.$attribute_name -eq "Disabled") { $uri = "https://$idrac_ip/redfish/v1/Managers/iDRAC.Embedded.1/Attributes" $JsonBody = @{"Attributes"=@{"OS-BMC.1.AdminState" = "Enabled"}} $JsonBody = $JsonBody | ConvertTo-Json -Compress try { if ($global:get_powershell_version -gt 5) { $result = Invoke-WebRequest -UseBasicParsing -SkipHeaderValidation -SkipCertificateCheck -Uri $uri -Credential $credential -Body $JsonBody -Method Patch -ContentType 'application/json' -Headers @{"Accept"="application/json"} -ErrorVariable RespErr } else { Ignore-SSLCertificates $result = Invoke-WebRequest -UseBasicParsing -Uri $uri -Credential $credential -Method Patch -ContentType 'application/json' -Headers @{"Accept"="application/json"} -Body $JsonBody -ErrorVariable RespErr } } catch { Write-Host $RespErr break } } # Create body payload for POST command $JsonBody = @{} if ($companyname) { $JsonBody["CompanyName"] = $companyname } if ($country) { $JsonBody["Country"] = $country } if ($email) { $JsonBody["PrimaryEmail"] = $email } if ($firstname) { $JsonBody["PrimaryFirstName"] = $firstname } if ($lastname) { $JsonBody["PrimaryLastName"] = $lastname } if ($phonenumber) { $JsonBody["PrimaryPhoneNumber"] = $phonenumber } if ($street) { $JsonBody["Street1"] = $street } if ($city) { $JsonBody["City"] = $city } if ($state) { $JsonBody["State"] = $state } if ($zip) { $JsonBody["Zip"] = $zip } Write-Host "`n- Keys and Values being passed in for POST action 'SupportAssistRegister' -`n" $JsonBody $JsonBody = $JsonBody | ConvertTo-Json -Compress $uri = "https://$idrac_ip/redfish/v1/Dell/Managers/iDRAC.Embedded.1/DellLCService/Actions/DellLCService.SupportAssistRegister" try { if ($global:get_powershell_version -gt 5) { $post_result = Invoke-WebRequest -UseBasicParsing -SkipHeaderValidation -SkipCertificateCheck -Uri $uri -Credential $credential -Body $JsonBody -Method Post -ContentType 'application/json' -Headers @{"Accept"="application/json"} -ErrorVariable RespErr } else { Ignore-SSLCertificates $post_result = Invoke-WebRequest -UseBasicParsing -Uri $uri -Credential $credential -Method Post -ContentType 'application/json' -Headers @{"Accept"="application/json"} -Body $JsonBody -ErrorVariable RespErr } } catch { Write-Host $RespErr break } if ($post_result.StatusCode -eq 200 -or $post_result.StatusCode -eq 202) { Write-Host "`n- PASS, POST command passed to register Support Assist" break } else { [String]::Format("- FAIL, POST command failed to register Support Assist, statuscode {0} returned. Detail error message: {1}",$post_result.StatusCode, $post_result) return } } # Function to execute Support Assist collection $Global:job_id = $null function execute_support_assist_collection { # Create body payload for POST command if ($execute_SA_collection.Contains(",")) { $string_split = $execute_SA_collection.Split(",") $JsonBody = @{"ShareType"="Local";"DataSelectorArrayIn"=''} $data_selector_array = @() [System.Collections.ArrayList]$data_selector_array = $data_selector_array foreach ($item in $string_split) { if ($item -eq 0) { $data_selector_array+="DebugLogs" } if ($item -eq 1) { $data_selector_array+="HWData" } if ($item -eq 2) { $data_selector_array+="OSAppData" } if ($item -eq 3) { $data_selector_array+="TTYLogs" } } $JsonBody["DataSelectorArrayIn"] = $data_selector_array Write-Host "`n- Keys and Values being passed in for POST action 'SupportAssistCollection' -`n" $JsonBody $JsonBody = $JsonBody | ConvertTo-Json -Compress } else { $JsonBody = @{"ShareType"="Local";"DataSelectorArrayIn"=[System.Collections.ArrayList]@()} if ($execute_SA_collection -eq 0) { $JsonBody["DataSelectorArrayIn"]+="DebugLogs" } if ($execute_SA_collection -eq 1) { $JsonBody["DataSelectorArrayIn"]+="HWData" } if ($execute_SA_collection -eq 2) { $JsonBody["DataSelectorArrayIn"]+="OSAppData" } if ($execute_SA_collection -eq 3) { $JsonBody["DataSelectorArrayIn"]+="TTYLogs" } Write-Host "`n- Keys and Values being passed in for POST action 'SupportAssistCollection' -`n" $JsonBody $JsonBody = $JsonBody | ConvertTo-Json -Compress } $uri = "https://$idrac_ip/redfish/v1/Dell/Managers/iDRAC.Embedded.1/DellLCService/Actions/DellLCService.SupportAssistCollection" try { if ($global:get_powershell_version -gt 5) { $post_result = Invoke-WebRequest -UseBasicParsing -SkipHeaderValidation -SkipCertificateCheck -Uri $uri -Credential $credential -Body $JsonBody -Method Post -ContentType 'application/json' -Headers @{"Accept"="application/json"} -ErrorVariable RespErr } else { Ignore-SSLCertificates $post_result = Invoke-WebRequest -UseBasicParsing -Uri $uri -Credential $credential -Method Post -ContentType 'application/json' -Headers @{"Accept"="application/json"} -Body $JsonBody -ErrorVariable RespErr } } catch { Write-Host $RespErr break } if ($post_result.StatusCode -eq 202 -or $post_result.StatusCode -eq 200) { $job_id_search=$post_result.Headers['Location'] $Global:job_id=$job_id_search.Split("/")[-1] [String]::Format("`n- PASS, statuscode {0} returned successfully for POST command to create update job ID '{1}'",$post_result.StatusCode, $Global:job_id) Write-Host } else { [String]::Format("- FAIL, statuscode {0} returned. Detail error message: {1}",$post_result.StatusCode,$post_result) return } } function loop_job_status { $get_time_old=Get-Date -DisplayHint Time $start_time = Get-Date $end_time = $start_time.AddMinutes(50) $force_count=0 Write-Host "- WARNING, script will now loop polling the job status every 30 seconds until marked completed`n" while ($true) { $loop_time = Get-Date $uri ="https://$idrac_ip/redfish/v1/Managers/iDRAC.Embedded.1/Jobs/$Global:job_id" try { if ($global:get_powershell_version -gt 5) { $result = Invoke-WebRequest -SkipCertificateCheck -SkipHeaderValidation -Uri $uri -Credential $credential -Method Get -UseBasicParsing -ErrorVariable RespErr -Headers @{"Accept"="application/json"} } else { Ignore-SSLCertificates $result = Invoke-WebRequest -Uri $uri -Credential $credential -Method Get -UseBasicParsing -ErrorVariable RespErr -Headers @{"Accept"="application/json"} } } catch { Write-Host $RespErr break } try { $SA_report_file_location = $result.Headers.Location } catch { Write-Host "- FAIL, unable to locate file location in headers output" break } $overall_job_output=$result.Content | ConvertFrom-Json if ($overall_job_output.Message.Contains("Fail") -or $overall_job_output.Message.Contains("Failed") -or $overall_job_output.Message.Contains("fail") -or $overall_job_output.Message.Contains("failed") -or $overall_job_output.Message.Contains("already")) { Write-Host [String]::Format("- FAIL, job id $Global:job_id marked as failed, error message: {0}",$overall_job_output.Message) break } elseif ($overall_job_output.Message.Contains("partially") -or $overall_job_output.Message.Contains("part")) { Write-Host [String]::Format("- WARNING, job id $Global:job_id completed with issues, check iDRAC Lifecyle Logs for more details. Final job message: {0}",$overall_job_output.Message) $get_current_time=Get-Date -DisplayHint Time $final_time=$get_current_time-$get_time_old $final_completion_time=$final_time | select Minutes,Seconds Write-Host "`n- PASS, job ID '$Global:job_id' successfully marked as completed" Write-Host "`nSupport Assist collection job execution time:" $final_completion_time Write-Host "`n- URI Support Assist collection file location: $SA_report_file_location`n" $user_answer = Read-Host -Prompt "`n- Would you like to use default browser to download SA collection file now? Type 'y' for yes or 'n' for no" if ($user_answer.ToLower() -eq "y") { start https://$idrac_ip/redfish/v1/Dell/sacollect.zip Write-Host "`n- User selected to download the SA collection file now, check your default browser session" break } elseif ($user_answer.ToLower() -eq "n") { Write-Host "`n- User selected to not download the SA collection file. SA collection file can still be accessed by executing a GET on URI 'https://<idrac_ip>/redfish/v1/Dell/sacollect.zip'" break } else { return } } elseif ($loop_time -gt $end_time) { Write-Host "- FAIL, timeout of 50 minutes has been reached before marking the job completed" break } elseif ($overall_job_output.Message -eq "The SupportAssist Collection Operation is completed successfully." -or $overall_job_output.Message -eq "Job completed successfully." -or $overall_job_output.Message.Contains("complete")) { $get_current_time=Get-Date -DisplayHint Time $final_time=$get_current_time-$get_time_old $final_completion_time=$final_time | select Minutes,Seconds Write-Host "`n- PASS, job ID '$Global:job_id' successfully marked as completed" Write-Host "`nSupport Assist collection job execution time:" $final_completion_time Write-Host "`n- URI Support Assist collection file location: $SA_report_file_location`n" $user_answer = Read-Host -Prompt "`n- Would you like to use default browser to download SA collection file now? Type 'y' for yes or 'n' for no" if ($user_answer.ToLower() -eq "y") { start https://$idrac_ip/redfish/v1/Dell/sacollect.zip Write-Host "`n- User selected to download the SA collection file now, check your default browser session" break } elseif ($user_answer.ToLower() -eq "n") { Write-Host "`n- User selected to not download the SA collection file. SA collection file can still be accessed by executing a GET on URI 'https://<idrac_ip>/redfish/v1/Dell/sacollect.zip'" break } else { break } } else { Write-Host "- Job ID '$Global:job_id' not marked completed, checking job status again" Start-Sleep 30 } } } # Run cmdlet get_powershell_version setup_idrac_creds # Check to validate iDRAC version detected supports this feature $uri = "https://$idrac_ip/redfish/v1/Dell/Managers/iDRAC.Embedded.1/DellLCService" try { if ($global:get_powershell_version -gt 5) { $get_result = Invoke-WebRequest -SkipCertificateCheck -SkipHeaderValidation -Uri $uri -Credential $credential -Method Get -UseBasicParsing -ErrorVariable RespErr -Headers @{"Accept"="application/json"} } else { Ignore-SSLCertificates $get_result = Invoke-WebRequest -Uri $uri -Credential $credential -Method Get -UseBasicParsing -ErrorVariable RespErr -Headers @{"Accept"="application/json"} } } catch { Write-Host $RespErr return } if ($get_result.StatusCode -eq 200 -or $result.StatusCode -eq 202) { $get_actions = $get_result.Content | ConvertFrom-Json $support_assist_collection_action_name = "#DellLCService.SupportAssistCollection" $validate_supported_idrac = $get_actions.Actions.$support_assist_collection_action_name try { $test = $validate_supported_idrac.GetType() } catch { Write-Host "`n- WARNING, iDRAC version detected does not support this feature using Redfish API or incorrect iDRAC user credentials passed in.`n" return } } else { Write-Host "`n- WARNING, iDRAC version detected does not support this feature using Redfish API or incorrect iDRAC user credentials passed in`n" return } if ($get_SA_license_agreement_info.ToLower() -eq "y") { get_support_assist_license_agreement } elseif ($accept_SA_license_agreement.ToLower() -eq "y") { accept_support_assist_license_agreement } elseif ($register_SA.ToLower() -eq "y") { register_support_assist_feature } elseif ($execute_SA_collection) { execute_support_assist_collection loop_job_status } else { Write-Host "- FAIL, either incorrect parameter(s) used or missing required parameters(s)" } } |