added function to create vmware.hv.securestring password

This commit is contained in:
Wouter Kursten
2018-05-22 19:22:02 +02:00
committed by GitHub
parent 748adc6f27
commit 73d7eaa992

View File

@@ -106,6 +106,23 @@ function Get-JsonObject {
}
}
function new-hvpassword{
#Requires input of type securestring and replies with vmware.hv.securestring
param(
[string]$pwin
)
$temppw = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($pwin)
$PlainPassword = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto($temppw)
$plainpassword
$SecPassword = New-Object VMware.Hv.SecureString
$enc = [system.Text.Encoding]::UTF8
$SecPassword.Utf8String = $enc.GetBytes($PlainPassword)
return $SecPassword
}
function Get-MapEntry {
param(
[Parameter(Mandatory = $true)]