DemitasseNZ / vSphereAutoLab

Nested vSphere lab that builds itself
Apache License 2.0
14 stars 6 forks source link

Validate script password string handling #26

Open DemitasseNZ opened 9 years ago

DemitasseNZ commented 9 years ago

When I build AutoLab and wait for the DC to ask me for password change and choose Pa$$w0rd123 (I choose this for temporal stuff), somehow the password that get into the B:\Automate\Hosts*.cfg its different, its missing a “$” (it ended being Pa$w0rd123). If I edit the password in automate.ini before the DC asked for it, everything goes fine and ended as expected.

DemitasseNZ commented 8 years ago

$ is a special character in PowerShell, so handling it in strings is hard. Need to look at whether there is better way to pass string that doesn't cause $$ to be mangled

aredan commented 8 years ago

Meanwhile, you can add a routine to verify that the user don't use a password with $$. There must be something more critical than fixing this :)

DemitasseNZ commented 6 years ago

The general solution is to use escaping function [regex]::escape() I'll need to look into whether this is useful for file reading. Another option is to document escaping for the entry in automate.ini https://blogs.technet.microsoft.com/heyscriptingguy/2016/09/30/powertip-how-to-escape-characters-in-a-string-using-regular-expressions/