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.
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:
The program will request the following input for a Run Command On Workstation job:
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.
SmsDataSourceConnect
SmsDataSourceDisconnect
SmsOpenContainer
SmsCloseContainer
SmsCreateFolder
SmsLinkFolder
SmsCommitFolder
SmsCloseFolder
SmsGetNextFolder
SmsSetScalar
SmsGetScalarByName
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.