One of our customers is using Microsoft System Center Configuration Manager (SCCM) to manage software on their network. SCCM requires a client to be installed on each computer. They wanted to use a VB script that checks common errors that cause the SCCM client to stop working and will install the client if it is not installed. I modified a script that was downloaded from the Internet that seemed to meet their needs. The customer has VB scripts set to edit instead of open, so I had to call the VB script from a batch file using cscript. [more]

The script ran fine when testing it from my login by calling it from a command prompt using cscript and then the file path. The batch files calls the VB script, which then does several tests and calls the SCCM install exe if necessary. After setting up group policy to run the script as a startup script, the script would start to run and then fail in the middle of the SCCM client install. During testing, we inserted a “pause” at the end of the batch file and found that the SCCM client installed properly.

What was happening was the SCCM install would immediately quit when the parent batch file ended. There are two ways to fix this problem. The first is to add “ping –n 600” so the batch script will stay open for 10 minutes, which is enough time for the install to complete. Occasionally, this method causes the computer to wait until the batch file completes before it will load the user’s desktop. The second option is to run the batch file as a scheduled task. The scheduled task will be set by another batch files run through group policy. The scheduled task option seems to be the most reliable path at this point because no side effects are seen with this method.