SRVINST.EXE

Overview

SRVINST.EXE is a console mode application that can be used for creating server install jobs or Run Command on Workstation jobs and monitoring the status of these jobs. This code demonstrates datasource connection, folder creation, scalar manipulation, and helper functions.

Running the Program

SRVINST.EXE runs as a console application. The program prompts you to enter the information needed to connect to SQL Server and then displays a list of sites to target. It then prompts you to enter the target job platforms, and then lets you select the type of job to create.

The program will request the following input for a Share Package On Server job:

Package name
User-defined name of the package.
Package comment
User-defined text.
Package location (UNC path)
The path to the directory where the package files are located.
Package share name
The name that the package will be shared as on the server.
Program item description
User-defined text.
Program item command line
The command to execute on the server.
Program item registry name
User-defined registry key for the package.

The program will request the following input for a Run Command On Workstation job:

Package name
User-defined name of the package.
Package comment
User-defined text.
Package location (share name)
The path to the directory where the client package is located.
WCL Name
User-defined name for the workstation command line.
WCL Command
The command line to execute.

Note If you choose to create a Share Package On Server job or a Run Command On Workstation job, then you must first share the directory where the package files are located.

Functions

SmsDataSourceConnect
SmsDataSourceDisconnect
SmsOpenContainer
SmsCloseContainer
SmsCreateFolder
SmsLinkFolder
SmsCommitFolder
SmsCloseFolder
SmsGetNextFolder
SmsSetScalar
SmsGetScalarByName

Program Flow

After logging on to the datasource, a list of sites is displayed and the user is asked to select the site that the job will be run on. This site list is obtained by opening the site container and enumerating the sites found there. The code then queries the user for the platform type and converts the selected platform index to the corresponding platform flag. The user is then asked to choose between a Share Package On Server job or Run Command On Workstation job. The user is asked to enter the necessary scalar values for the job, and the job is created. The code then enters a loop where the status of the job is monitored and displayed periodically until the job completes.