Microsoft Windows Resource Kit Utilities |
Historical Reference |
PxPlus can be installed as a Windows Service, which is a special process designed to start and run automatically under Windows directly from start-up; e.g. a networking or remote access procedure. The three primary methods for setting up service entry points to PxPlus (pxplus.exe) are outlined below.
The Windows Resource Kit includes two utilities for creating a service: instsrv.exe, which installs/removes system services from Windows, and srvany.exe, which allows an application to run as a service. The following steps describe how to use these utilities:
1. |
Install instsrv.exe and srvany.exe in a directory; e.g. create d:\tools\ and copy the files to this location. |
2. |
Create the service using the command line: ServiceName is the name that will appear in the Services control panel. |
3. |
From your desktop, select Start > Parameters > Control Panel > Services. Select the service name created in Step 2, and then select the Start-Up button. |
4. |
Set up the service as Auto-Start, and select a user account and password, or a LocalSystem account. Note: |
5. |
From your desktop, select Start > Run > regedt32. Under HKEY_LOCAL_MACHINE\SYSTEM\Current\ControlSet\Services\ServiceName, create a key named 'Parameters'. Under this key, create the following values:
Due to a restriction enforced by Windows NT on services, an application can either be interactive (have a console, read keyboard input, etc.) or have network access - not both at the same time. | ||||||||||||||||||
6. |
To allow LocalSystem services on any machine in the domain to access a specific share on a server, use the Registry Editor to add the name of that share to: | ||||||||||||||||||
7. |
Quit regedt32.exe and reboot the server. |
PxPlus supports command line options for installation as a true Windows Service. Currently, only Start and Stop functions are supported - Pause and Continue functions may be added in a future release.
Install Service
path\pvx\pxplus.exe -i [pxplus.ini] ServiceName ServiceDisplayName StartType StartInDirectory CommandLine [ ServiceDescription ][ Account ][ Password ]
Where:
ServiceName |
Name that will appear in the Services control panel. |
ServiceDisplayName |
Name that appears in the Services control panel. |
StartType |
Service start-up option, value between 1 and 3: |
StartInDirectory |
Directory used as the start-up directory for the service. |
CommandLine |
Command-line arguments with which to start PxPlus. |
ServiceDescription |
Description that appears in the Services control panel. |
Account |
Domain and account to run the service as. If the account is set to "interactive" (case insensitive), then the service will be setup to use the LocalSystem account and interact with the desktop. |
Password |
Password for the above account. |
Start Service
path\pvx\pxplus.exe -s [pxplus.ini] ServiceName
Where:
ServiceName is the name that will appear in the Services control panel.
Uninstall Service
path\pvx\pxplus.exe -u [pxplus.ini] ServiceName
Where:
ServiceName is the name that will appear in the Services control panel.
The -s option will not start the service unless it is executed by the Service Manager. It will appear as the command line argument in the Service Properties panel. If the pxplus.ini file used by the executable contains a LogFile= entry, then any errors that occur during the install, uninstall, or start of the service will be logged.
If a Windows function fails, then the last error code will be logged. These can be found in MSDN under "System Error Codes" (index entry "error codes [Win32]"). Any parameter containing spaces requires a delimiter character of either " (quote) or ' (apostrophe). Leading/trailing apostrophes are always stripped. Leading/trailing quotes are stripped from StartType, ServiceDisplayName, ServiceDescription, Account and Password.
TCB(170) returns the service handle. The value will be zero if the program is not running as a service. This only applies to a PxPlus executable installed and started using the -i and -s options above.
Example:
>pxplus.exe -i "PvxWeb" "PxPlus WebConfig" 1 "C:\PVX Plus Technologies\PxPlus version_number" "*web\webcfg" "My PxPlus Web Configuration Screen" "interactive"
>pxplus.exe -u "PvxWeb"
The PxPlus object *obj\ntservice can be used to manipulate Windows Services. The following methods are currently available:
|
CreatePxPlusService( ) |
DeletePxPlusService( ) |
StartService( ) |
|
StopService( ) |
ServiceState( ) |
OpenService( ) |
|
CloseService( ) |
|
|
Example:
00010 let a=new("*obj/ntservice")
00020 let servicename$="pvxapp"
00030 let displayname$="PxPlus appcfg"
00040 let description$="PxPlus application server config"
00050 let commandline$="-bkg *appserv\config"
00060 let startindirectory$="C:\PVX Plus Technologies\PxPlus version_number"
00070 let starttype=1
00080 let useraccount$=""
00090 let userpassword$=""
00100 let interactwithdesktop=1
00110 print a'createpxplusservice(servicename$,displayname$, description$,commandline$,startindirectory$,starttype,useraccount$,userpassword$,interactwithdesktop)
00120 let sh=a'openservice(servicename$)
00130 print a'servicestate(sh)
00140 print a'startservice(sh)
00150 print a'servicestate(sh)
00155 escape
00160 print a'stopservice(sh)
00170 print a'deletepxplusservice(servicename$)
00180 end