From df83277c066cb7293b0a5de58401ce008fb4a5da Mon Sep 17 00:00:00 2001 From: Wes Carroll Date: Mon, 6 Apr 2020 17:15:52 -0400 Subject: [PATCH] Create Set-ZertoUserCredential.ps1 --- .../Public/Set-ZertoUserCredential.ps1 | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 ZertoApiWrapper/Public/Set-ZertoUserCredential.ps1 diff --git a/ZertoApiWrapper/Public/Set-ZertoUserCredential.ps1 b/ZertoApiWrapper/Public/Set-ZertoUserCredential.ps1 new file mode 100644 index 0000000..71495b3 --- /dev/null +++ b/ZertoApiWrapper/Public/Set-ZertoUserCredential.ps1 @@ -0,0 +1,33 @@ +<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #> +function Set-ZertoUserCredential { + [cmdletbinding( + SupportsShouldProcess, + ConfirmImpact = 'High' + )] + param( + [Parameter( + HelpMessage = "PSCredential Object that conatins the username and password for the updated credentials.", + Mandatory + )] + [pscredential]$UserCredential + ) + + begin { + + } + + process { + $uri = '/localsite/virtualizationsettings' + $body = @{ + UserName = $UserCredential.UserName + Password = $UserCredential.GetNetworkCredential().Password + } + if ( $PSCmdlet.ShouldProcess( $script:zertoServer, "Updating hypervisor service account credentials" )) { + Invoke-ZertoRestRequest -uri $uri -Method PUT -body ($body | ConvertTo-Json) + } + } + + end { + + } +}