Files
ZertoApiWrapper/ZertoApiWrapper/Public/Set-ZertoUserCredential.ps1
T
2020-04-07 10:27:22 -04:00

36 lines
925 B
PowerShell

<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
function Set-ZertoUserCredential {
[cmdletbinding(
SupportsShouldProcess,
ConfirmImpact = 'High'
)]
param(
[Parameter(
HelpMessage = "PSCredential Object that contains the username and password for the updated credentials.",
Mandatory
)]
[pscredential]$UserCredential
)
begin {
}
process {
$uri = '/localsite/virtualizationsettings'
$body = @{
Credentials = @{
UserName = $UserCredential.UserName
Password = $UserCredential.GetNetworkCredential().Password
}
}
if ( $PSCmdlet.ShouldProcess( $script:zvmServer, "Updating hypervisor service account credentials" )) {
Invoke-ZertoRestRequest -uri $uri -Method PUT -body ($body | ConvertTo-Json)
}
}
end {
}
}