Added ability to updated Host Password
This commit is contained in:
@@ -31,7 +31,13 @@ function Edit-ZertoVra {
|
||||
HelpMessage = "Subnetmask to be assigned to the VRA"
|
||||
)]
|
||||
[ValidateScript( { $_ -match [IPAddress]$_ })]
|
||||
[string]$subnetMask
|
||||
[string]$subnetMask,
|
||||
[Parameter(
|
||||
HelpMessage = "Updated ESXi host root password."
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[securestring]$HostRootPassword
|
||||
|
||||
)
|
||||
|
||||
begin {
|
||||
@@ -77,8 +83,14 @@ function Edit-ZertoVra {
|
||||
$vraNetwork['VraIPConfigurationTypeApi'] = "Dhcp"
|
||||
$vraUpdate['VraNetworkDataApi'] = $vraNetwork
|
||||
}
|
||||
if ($PSBoundParameters.ContainsKey('HostRootPassword')) {
|
||||
$HostRootCredential = [pscredential]::New('root', $HostRootPassword)
|
||||
$vraUpdate['UsePublicKeyInsteadOfCredentials'] = $false
|
||||
$vraUpdate['HostRootPassword'] = $HostRootCredential.GetNetworkCredential().Password
|
||||
}
|
||||
|
||||
# -WhatIf processing and submit!
|
||||
if ($PSCmdlet.ShouldProcess( "Updating " + $vra.vraName + " with these settings: $($vraUpdate | convertTo-Json)")) {
|
||||
if ($PSCmdlet.ShouldProcess( $vra.vraName )) {
|
||||
Invoke-ZertoRestRequest -uri $baseUri -body $($vraUpdate | ConvertTo-Json) -method "PUT"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user