So I’ve been working on getting some windows images sysprepped and ready to go. And I’ve hit a few bugs in the windows contextualization scripts. I want to make sure these are considered bugs. My setup is as follows.
First windows Image I’m trying to do this on is windows 7 professional a bit old. but the easiest? to work with. I have all 3 scripts in the D:\ Context drive. SetupComplete.cmd startup.vbs and context.ps1.
When I run SetupComplete.cmd it launches startup.vbs but it wasn’t calling powershell and going on to the unattended cleanup. in Debugging startup.vbs I found what it was doing.
Wscript.echo driveLetter
Wscript.echo Len(driveLetter)
If Not Len(driveLetter) Then
driveLetter = "C:"
End If
Wscript.echo driveLetter
The 3 echo statements output D:, 2, and C:
So at least on Windows 7 the If Not Len() check is true when the Len() == 2
From here it does nothing because it’s trying to find my context.ps1 on C when it’s on D.
The second issue I’m hitting at least in Win7 is in the addLocalUser section of context.ps1. The line:
if(!([ADSI[::Exists("WinNT://$computerName/$username))) {
causes the script to error out if $username is not set. I’m not planning on having contextualization add any local user accounts so I had to enclose most of the function inside an check that makes sure that $username and $password have values assigned.
$username = $context["USERNAME"]
$password = $context["PASSWORD"]
if( $username -And $password) {
...
}
So it seems like pretty easy fixes but I wanted to garner some opinions instead of just creating issues on github when i’m not sure if anyone is using the issue tracking on the project for this.
My next issue is that I want to have an additional-contextualization that can join the computer to a domain but I need to reboot after renameComputer before I can run my joinDomain function. I’ve been working on a work-around but it seems like a reasonable option to have in the default contextualization. the ability to reboot and resume contextualization without a hack.