Difference between revisions of "Installation instructions"
m |
m |
||
Line 92: | Line 92: | ||
All you have to do is to login to your Windows box, and issue these commands as Administrator - you can put them in one file which we call <code>wpkg-install.bat</code>: | All you have to do is to login to your Windows box, and issue these commands as Administrator - you can put them in one file which we call <code>wpkg-install.bat</code>: | ||
− | Here is a sample wpkg-install.bat file - the sum of steps 1-8 described below. You may want to change paths | + | Here is a sample wpkg-install.bat file - the sum of steps 1-8 described below. You may want to change some paths of course. |
<code>copy \\server\wpkg\files\srvany.exe %SystemRoot%\System32 | <code>copy \\server\wpkg\files\srvany.exe %SystemRoot%\System32 | ||
Line 111: | Line 111: | ||
* Pick a network drive. This drive must be accessable by the user WPKG is going to be configured to run as. We are using LocalSystem on Windows 2000. Windows XP has a new NetworkService account which begs examination. When LocalSystem attempts to access a file share, it does so under the identity of guest. Thus, guest must have read only access to your entire software share. | * Pick a network drive. This drive must be accessable by the user WPKG is going to be configured to run as. We are using LocalSystem on Windows 2000. Windows XP has a new NetworkService account which begs examination. When LocalSystem attempts to access a file share, it does so under the identity of guest. Thus, guest must have read only access to your entire software share. | ||
− | * Our first command copies <code>srvany.exe</code> and <code>instsrv.exe</code> to <code>%SystemRoot%\System32</code> | + | * Our first command copies <code>srvany.exe</code> and <code>instsrv.exe</code> to <code>%SystemRoot%\System32</code>: |
<code>copy \\server\wpkg\files\srvany.exe %SystemRoot%\System32 | <code>copy \\server\wpkg\files\srvany.exe %SystemRoot%\System32 |
Revision as of 13:26, 31 October 2005
Contents
Server side
Configuration on the server side is pretty straightforward. Considering you run Samba, add something like that to your smb.conf
file:
[wpkg] comment = Windows Packager path = /home/samba/wpkg read only = yes browseable = no valid users = guest, nobody guest ok = Yes
You also have to copy hosts.xml (host definition file), packages.xml (packages definition file), profiles.xml (profiles definition file) and wpkg.js files to the above defined path = /home/samba/wpkg
directory.
You have to edit the configuration files: hosts.xml, packages.xml and profiles.xml to suit your needs.
You don't have to edit wpkg.js, which is WPKG engine.
Optionally - depending on your client setup (below) - you will also have to copy three .exe files - srvany.exe
, instsrv.exe
and scripten.exe
, if you don't have them on your clients. To simplify, first copy them to your server - for example to /home/samba/wpkg/files
- and from there distribute them to your clients. This is described in a "Client side" below.
If you don't run Samba, but a Windows server with Active Directory instead - your server setup should be similar (creating a share etc.).
Additionally, create a small batch script called wpkg-start.bat
and put it on your server:
cscript \\server\wpkg\wpkg.js /synchronize /quiet
Then configure your Active Directory to run this script on a workstation when it is booted. Configuring Active Directory to run WPKG is described in more details in WPKG Wiki.
Client side
Client side installation is also pretty easy.
Basically, you need to run wpkg.js script when the workstation boots up, like below:
cscript \\server\wpkg\wpkg.js /synchronize /quiet
It can be done in many ways (note that cscript shipped with Windows 2000 is too old; you should download and install a newer version of scripten.exe - see the download link).
The most proper way to do it will depend on your setup, you have to decide which one to choose.
Using Windows Task Scheduler
- create a small batch script called wpkg-start.bat and put it on your server:
cscript \\server\wpkg\wpkg.js /synchronize /quiet
Note that cscript binary, in the right version, is shipped by default on Windows XP and higher only (cscript shipped with Windows 2000 is too old; you should download and install a newer version of scripten.exe - see the download link).
- open Scheduled Tasks from Start Menu -> Accessories -> System Tools
- double-click "Add Scheduled Task" and choose "Next"
- click on Browse and locate the wpkg-start.bat file you just created
- choose "When my computer starts" and click Next
- type-in the Username and password (this user needs to have administrative rights)
- choose Next -> Finish
You will have see a scheduled job file, which you can copy to all other machines on the network (but you will have to renew credentials, as they are not stored in this file).
Alternatively, you may add a scheduled task from a command line (or during an Unattended install):
schtasks /create /tn wpkg /tr "\\server\wpkg\wpkg-start.bat" /sc onstart /ru domain\administrator /rp password
schtasks utility will work from the command line only in Windows XP or higher. If you have Windows 2000, and would like to install WPKG "silently", please see this page: http://www.windowsitpro.com/Article/ArticleID/25186/25186.html?Ad=1
Note that system commands in Windows are *incompatibile* in different language versions of Windows! I'm not joking now!
For example, in German version of Windows, this command would look like that (note the /sc
switch):
schtasks /create /tn wpkg /tr "\\server\wpkg\wpkg-start.bat" /sc beimstart /ru domain\administrator /rp password
If you're not sure, consult schtasks help:
schtasks /?
Client which is an Active Directory client
Basically, you don't have to configure anything on the client, because everything was configured on the Active Directory server (see above - Server side).
One thing you might need, is cscript binary - it is not shipped with Windows 2000, so you may have to add it to your clients (see above).
See also WPKG with Active Directory for a description with screenshots.
More sophisticated example - using srvany to create a system service
All you have to do is to login to your Windows box, and issue these commands as Administrator - you can put them in one file which we call wpkg-install.bat
:
Here is a sample wpkg-install.bat file - the sum of steps 1-8 described below. You may want to change some paths of course.
copy \\server\wpkg\files\srvany.exe %SystemRoot%\System32
copy \\server\wpkg\files\instsrv.exe %SystemRoot%\System32
instsrv "Windows Packager" "%SystemRoot%\System32\srvany.exe"
\\server\wpkg\files\scripten.exe /Q /R:N
cscript.exe \\server\wpkg\files\install-service.js
net start "Windows Packager"
We are using the srvany.exe
and instsrv.exe
programs included with the Windows 2000 Resource Kit to install the wpkg.js script with the /synchronize /quiet
options as a system service.
srvany.exe
and instsrv.exe
programs cannot be distributed along with this software - licensing and all. However, you can find links in the download section.
It is quite easy to implement this yourself (for impatient - all commands shown are available as copy/paste text and as downloads later below):
- Get
srvany.exe
andinstsrv.exe
files and put them on your file server.
- Pick a network drive. This drive must be accessable by the user WPKG is going to be configured to run as. We are using LocalSystem on Windows 2000. Windows XP has a new NetworkService account which begs examination. When LocalSystem attempts to access a file share, it does so under the identity of guest. Thus, guest must have read only access to your entire software share.
- Our first command copies
srvany.exe
andinstsrv.exe
to%SystemRoot%\System32
:
copy \\server\wpkg\files\srvany.exe %SystemRoot%\System32
copy \\server\wpkg\files\instsrv.exe %SystemRoot%\System32
- Then we run:
instsrv "Windows Packager" "%SystemRoot%\System32\srvany.exe"
This creates the Windows service called "Windows Packager". It is however not yet started.
- Next, we install the latest version of Windows Script Host on the system. Windows 2000 out of the box does not have a good enough version. Check Microsoft's web site for the Windows script software. The executable is named
scripten.exe
("Windows Script 5.6 for Windows 2000 and XP") . We launch it from thewpkg-install.bat
file as follows:
\\server\wpkg\files\scripten.exe /Q /R:N
This makes it install quietly and not reboot.
- Next in our
wpkg-install.bat
file, setup the registry entries neccassary forsrvany.exe
to properly start Windows Packager. It can be done by calling out to a JScript file:install-service.js
. This is done because the registry keys needed had the potential to be different for each system. Creating keys using code was ideal. Theinstall-service.js
file sets the following keys:
HKLM\System\CurrentControlSet\Services\Windows Packager\Parameters\Application
HKLM\System\CurrentControlSet\Services\Windows Packager\Parameters\AppParameters
The Application key specifies the full path to the executable that the service will run at boot. This is because we do not launch the wpkg.js file, we launch the Windows Scripting Host (cscript.exe
) and instruct it to launch the wpkg.js file. Set the Parameters key to:
\\server\wpkg\wpkg.js /synchronize /quiet
This instructs cscript.exe
to run the wpkg.js script, which is placed on the network share, with the two options shown. It will synchronize the system on boot, logging errors quietly.
- The last entry in the wpkg-install.bat file starts "Windows Packager" service:
net start "Windows Packager"
To sum up, we have two files needed to install WPKG on a given Windows machine: wpkg-install.bat
, which copies all needed files, and install-service.js
(started within wpkg-install.bat
), which installs WPKG as a service in Windows registry - so that it could be launched each time the machine is booted. wpkg-install.bat
needs to be run only once.
This is an example install-service.js
file:
</code>var WshShell = WScript.CreateObject("WScript.Shell"); var srvKey = "HKLM\\SYSTEM\\CurrentControlSet\\Services\\Windows Packager\\Parameters\\"; var appKey = srvKey + "Application"; var parKey = srvKey + "AppParameters"; var srvPath = WshShell.ExpandEnvironmentStrings("%SystemRoot%") + "\\System32\\cscript.exe" var srvArgs = "\\\\server\\wpkg\\wpkg.js /synchronize /quiet"; WshShell.RegWrite(appKey, srvPath, "REG_SZ"); WshShell.RegWrite(parKey, srvArgs, "REG_SZ");</code>
Running the wpkg-install.bat
file on a new system will now set up and run WPKG! Running this wpkg-install.bat
file as part of your Windows install answer file is ideal.
Watch Windows reboot. Imagine you have over 20 packages being installed, half of which require a reboot. It's amusing to see Windows reboot itself for 30 minutes installing stuff.