Skip to content

Commit 021e938

Browse files
authored
Merge pull request #42 from marcvaneijk/Escaping
Fix for escaping password
2 parents 4dc953d + c0baf36 commit 021e938

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

Deployment/PrepareBootFromVHD.ps1

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,13 @@ if ((get-disk | where {$_.isboot -eq $true}).Model -match 'Virtual Disk')
9292

9393
if (($ApplyUnattend) -and (!($AdminPassword)))
9494
{
95-
while ($AdminPassword.Length -le 6) {
96-
$AdminPassword = read-host 'Password for the local administrator account of the AzureStack TP2 host. Requires 6 characters minimum'
95+
while ($SecureAdminPassword.Length -le 6) {
96+
[System.Security.SecureString]$SecureAdminPassword = read-host 'Password for the local administrator account of the AzureStack TP2 host. Requires 6 characters minimum' -AsSecureString
9797
}
98+
$BSTR = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($SecureAdminPassword)
99+
$AdminPassword = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto($BSTR)
100+
Write-Host "The following password will be configured for the local administrator account of the Azure Stack TP2 host:"
101+
Write-Host $AdminPassword -ForegroundColor Cyan
98102
}
99103

100104
#region Validate disk space for expanding cloudbuilder.vhdx

0 commit comments

Comments
 (0)