Changes

Jump to: navigation, search

Installation instructions

9,124 bytes removed, 19:37, 15 August 2006
m
no edit summary
Additionally, create a small batch script called <code>wpkg-start.bat</code> and put it on your server:
<code>cscript \\server\wpkg\wpkg.js /synchronize /quiet/nonotify</code> Then [[WPKG_with_Active_Directory | configure your Active Directory]] to run this script on a workstation when it is booted.
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 =
See the [[download]] for link to download WSH. See [[Windows Scripting Host]] for an automated method to install WSH using a batch file.
 
== Starting wpkg Using Windows Task Scheduler ==
 
* create a small batch script called wpkg-start.bat and put it on your server:
 
<code>cscript \\server\wpkg\wpkg.js /synchronize /quiet</code>
 
* 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):
 
<code>schtasks /create /tn wpkg /tr "\\server\wpkg\wpkg-start.bat" /sc onstart /ru domain\administrator /rp password</code>
 
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 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 <code>/sc</code> switch):
 
<code>schtasks /create /tn wpkg /tr "\\server\wpkg\wpkg-start.bat" /sc beimstart /ru domain\administrator /rp password</code>
 
If you're not sure, consult schtasks help:
 
<code>schtasks /?</code>
 
 
 
== Starting wpkg using 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|WPKG with Active Directory]] for a description with screenshots.
 
== Starting wpkg using cygrunsrv.exe ==
 
An easy way to start WPKG as a service is to use cygrunsrv.exe from [http://www.cygwin.com Cygwin].<br>
You don't need to install Cygwin, it's enough if you copy cygrunsrv.exe binary and cygwin1.dll library.<br>
 
With cygrunsrv, it's easy to start WPKG as any user you want (SYSTEM, local administrator, domain administrator etc.)
 
For cygrunsrv usage, see <code>cygrunsrv --help</code>.
 
You can get cygwin1.dll from any Cygwin mirror, it's located in cygwin/release/cygwin (for example, cygwin-1.5.19-4.tar.bz2).<br>
cygrunsrv is located in cygwin/release/cygrunsrv (for example, cygrunsrv-1.16-1.tar.bz2).
 
Here's one working example:
 
<pre>
cygrunsrv -I wpkg -p '/cygdrive/c/WINDOWS/system32/cscript.exe' -a'c:\wpkg\wpkg\wpkg.js /quiet /synchronize' -c '/home/Administrator/wpkg/wpkg'
cygrunsrv -S wpkg
</pre>
 
Those arguments are:
 
; -I [name] : Install a service named [name]. In this example, we're calling it wpkg.
; -p [/path/to/executable] : Path to the command to run -- in this case, cscript.
; -a [arguments to executable] : Arguments for the executable -- in this case, the path to wpkg.js and how we want it to run.
; -c [directory] : Go to this directory before starting the program.
; -S [name] : Start the service.
 
There are a few things to note:
 
* The <code>-p</code> argument gives the path to cscript in the format Cygwin uses to get to Windows drives. In this format, the C: drive can be reached at <code>/cygdrive/c</code>, the D: drive can be reached at <code>/cygdrive/d</code>, and so on. Also, unlike Windows, Cygwin is case-sensitive -- so <code>/cygdrive/c/Windows</code> is ''not'' the same as <code>cygdrive/c/WINDOWS</code>.
* The <code>-a</code> argument is given in Windows format. Also, it is ''very'' specific to the (stupid) way I have wpkg set up on this machine.
* I'm unsure if the <code>-c</code> argument is necessary, but it works for me. It's given in Cygwin/Unix format, and is again very specific to the stupid way I have things set up. I'm unsure what to put here if all you're doing is copying around the Cygwin DLL.
* Cygwin saves the STDERR output to <code>/var/log/wpkg.log</code> (assuming you named the service wpkg). Again, I'm not sure where this would go if you're just copying around the Cygwin DLL.
 
== Starting wpkg using srvany to create a system service (advanced) ==
 
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 some paths of course.
 
<code>SET SRVPATH=\\server\wpkg\files\
copy %SRVPATH%\srvany.exe %SystemRoot%\System32
copy %SRVPATH%\instsrv.exe %SystemRoot%\System32
instsrv "Windows Packager" "%SystemRoot%\System32\srvany.exe"
%SRVPATH%\scripten.exe /Q /R:N
cscript.exe %SRVPATH%\install-service.js
net start "Windows Packager"</code>
 
 
We are using the <code>srvany.exe</code> and <code>instsrv.exe</code> programs included with the Windows 2000 Resource Kit to install the [[wpkg.js]] script with the <code>/synchronize /quiet</code> options as a system service.
<code>srvany.exe</code> and <code>instsrv.exe</code> 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 <code>srvany.exe</code> and <code>instsrv.exe</code> 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 <code>srvany.exe</code> and <code>instsrv.exe</code> to <code>%SystemRoot%\System32</code>:
 
<code>copy \\server\wpkg\files\srvany.exe %SystemRoot%\System32
copy \\server\wpkg\files\instsrv.exe %SystemRoot%\System32</code>
 
* Then we run:
 
<code>instsrv "Windows Packager" "%SystemRoot%\System32\srvany.exe"</code>
 
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 <code>scripten.exe</code> ("Windows Script 5.6 for Windows 2000 and XP") . We launch it from the <code>wpkg-install.bat</code> file as follows:
 
<code>\\server\wpkg\files\scripten.exe /Q /R:N</code>
 
This makes it install quietly and not reboot.
 
* Next in our <code>wpkg-install.bat</code> file, setup the registry entries neccassary for <code>srvany.exe</code> to properly start Windows Packager. It can be done by calling out to a JScript file: <code>install-service.js</code>. This is done because the registry keys needed had the potential to be different for each system. Creating keys using code was ideal. The <code>install-service.js</code> file sets the following keys:
 
<code>HKLM\System\CurrentControlSet\Services\Windows Packager\Parameters\Application
HKLM\System\CurrentControlSet\Services\Windows Packager\Parameters\AppParameters</code>
 
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 (<code>cscript.exe</code>) and instruct it to launch the [[wpkg.js]] file. Set the Parameters key to:
 
<code>\\server\wpkg\wpkg.js /synchronize /quiet</code>
 
This instructs <code>cscript.exe</code> 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:
 
<code>net start "Windows Packager"</code>
 
 
To sum up, we have two files needed to install WPKG on a given Windows machine: <code>wpkg-install.bat</code>, which copies all needed files, and <code>install-service.js</code> (started within <code>wpkg-install.bat</code>), which installs WPKG as a service in Windows registry - so that it could be launched each time the machine is booted. <code>wpkg-install.bat</code> needs to be run only once.
This is an example <code>install-service.js</code> file:== Starting WPKG using WPKG Installer ==
var WshShell = WScriptIn August 2006 we have written a client side WPKG installer.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, srvArgsIt is distributed as a MSI package, "REG_SZ");and it can work in two modes:
* GUI - where you can point and click every aspect of your WPKG installation on a given workstation,
* CLI - command line - recommended for advanced users and for scripted installations; here parameters have to be given in the command line.
Running the <code>wpkg-install.bat</code> file on a new system will now set up and run You can download WPKG! Running this <code>wpkg-install.bat</code> file as part of your Windows install answer file is idealInstaller on the [[Download | download page]], usage instructions are in the package.
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.
==[[Installation instructions - advanced | Other, advanced and custom installation methods]] ==
[[Category:Installation]]

Navigation menu