diff --git a/Modules/VMware.Hv.Helper/VMware.HV.Helper.psm1 b/Modules/VMware.Hv.Helper/VMware.HV.Helper.psm1 index a0bfb26..faecc37 100644 --- a/Modules/VMware.Hv.Helper/VMware.HV.Helper.psm1 +++ b/Modules/VMware.Hv.Helper/VMware.HV.Helper.psm1 @@ -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)]