Jump to content

%REBOOT% then map drives to resume network install


Recommended Posts

Hello all,

I've been using WPI for some time and have always had great luck; however, I'm banging my head on this problem. :)

In order to install IE7 on my RIS based installation, I need to have the computer reboot and resume WPI. That's easy with the %REBOOT% command, and it's easy enough to modify my ris config to auto-login a second (or third, fourth, etc) time. The problem that I'm running into is that WPI loads before explorer and runs off a mapped drive (G: in this case), so after the reboot, I'm at a loss as to how I could map the drives before WPI attempts to load.

Since this is a RIS install, and due to the way the images are made, I can't nlite or otherwise integrate IE7 and .Net's into the sources themselves, so I have to install them after windows. Problem is, that if I try to install it before the reboot, IE7 will go through it's paces and 'install' with no errors, but won't actually update the system and has to be reinstalled after the final reboot.

Anyone know of a good way to map the drive prior to WPI running on the reboot? First run is no problem, as it's handled as a step in my setup routine, but once it installs most of everything and reboots to do IE7 and my cleanup file, all is lost.

Any help would be appreciated. The only thing that I can think of would be to find out at what vector WPI is loading at and try to manually stub the registry to load a script or batch/cmd file before running WPI. (problem is I don't know where WPI is trying to load from)

Thoughts?

Diamond187

Link to comment
Share on other sites


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.

Link to comment
Share on other sites

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!).

Link to comment
Share on other sites

Couldn't you just use a RegEdit in a command to add the key early in the install process, then remove when done? Maybe in Execute Before/After?

Yes, don't edit the code manually. Something will go wrong down the road.

Link to comment
Share on other sites

Couldn't you just use a RegEdit in a command to add the key early in the install process, then remove when done? Maybe in Execute Before/After?

Yes, don't edit the code manually. Something will go wrong down the road.

Yes, that would be a much better idea, I was just in a hurry and didn't want to test whether WPI's reboot command would overwrite my value since it was hardcoded to be at 001; additionally, I'd assume that since it is looking for %REBOOT% then immediately writing the reg keys and doing the reboot, it would overwrite my RunOnce\001 with it's own. In this case, I'm *sure* there's a cleaner way to do it, but laziness won out due to lack of proper testing time. :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...