chaoticyeshua, on Nov 13 2008, 04:42 PM, said:
When you "net use" in the cmd file that maps the drive, you could use the /persistent:yes switch, which will cause it to auto-map the drive again at logon. I haven't tried this, as I don't have to reboot in my installations, but it might work. You'd just probably have to unmap the drive manually.
Good idea, but although it is persistant, in this case we're logging in from RIS to the local computer, so therefore the map script gives a user / password to use to login with... when you check it to be persistant, it will still prompt you for a username and password after trying to map it via the local COMPUTERNAME\Administrator and that password (which, of course isn't the same as the domains "Administrator" for obvious security reasons.
I have found a temporary workaround; it isn't pretty per se, but it does manage to get the job done. Here's what I did:
The last script that executes, which does the .NET and IE7 I split into two files, the first installs the .NET installers and copys a simple batch file called recon.cmd to the local C:\
The second part was the place where it's ugly.. I modified the code in WPI itself on the reboot section to add an entry before it starts WPI to run that file. Namely, in installer.js, I changed this:
Starting on line 165:
if (LoadDesktopBeforeInstall)
{
WriteRegKey("HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnce\\WPIresume",'mshta "'+wpipath+'\\Common\\Installer.hta"',"REG_SZ");
}
else
{
WriteRegKey("HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnceEx\\001\\","","REG_SZ");
WriteRegKey("HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnceEx\\001\\1",'mshta "'+wpipath+'\\Common\\Installer.hta"',"REG_SZ");
}
To This:
if (LoadDesktopBeforeInstall)
{
WriteRegKey("HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnce\\MapDrives",'C:\\recon.cmd',"REG_SZ");
WriteRegKey("HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnce\\WPIresume",'mshta "'+wpipath+'\\Common\\Installer.hta"',"REG_SZ");
}
else
{
WriteRegKey("HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnceEx\\001\\","","REG_SZ");
WriteRegKey("HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnceEx\\001\\1",'C:\\recon.cmd',"REG_SZ");
WriteRegKey("HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnceEx\\002\\","","REG_SZ");
WriteRegKey("HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnceEx\\002\\2",'mshta "'+wpipath+'\\Common\\Installer.hta"',"REG_SZ");
}
The recon.cmd file simple issues the net use commands, for instance mine is:
@Echo off
REM - Clear any old map, to ensure that it doesn't try to connect w/wrong credentials
net use /d Z:
REM - Now, map the drive
net use Z: \\SERVER\INSTALLS "PASSWORDGOESHERE" /u:UsernameOfInstaller
You do need to create a username (which I did long ago, with a *very* archaic password) that has the appropriate permissions to install your software, and of course change the server, share, password, and username to fit your needs.
If Kel or anyone else knows of a cleaner way to do this I'd love to hear it, as I *hate* hacking into the code itself since inevitability you'll update a version and forget about the hack; plus, in many cases it can cause other odd behaviors that the dev's wouldn't have the foggiest clue about (since you created the problem!).