How to: Performing Scripted CMD 2.0 Endpoint Subscriptions

How to: Performing Scripted CMD 2.0 Endpoint Subscriptions

May 21

With the recent release of StorageCraft ShadowControl CMD v2.0 many of you are upgrading from a previous version or simply downloading the CMD 2.0 ISO image and trying it out for the first time. It’s important to note that the endpoint agent running on the client system must match the same version as the ShadowControl CMD webserver in order for communications between the client and the CMD device to flow properly. There are many ways to update the endpoint agent. In this article, I’m documenting one of those ways that this endpoint update might be accomplished and providing an example script that can be used to do it.

Much of what you will see in the following script can be modified to suit your own specific needs. The script is a batch file intended to be run at the endpoint device. Running the script from the endpoint device can be accomplished several ways, including: adding the script to a login script on a domain controller, using an RMM tool to deploy the batch file, or remotely controlling the machine and running the script. You’re welcome to decide which way best fits your needs in your environment.

Let’s get started. My goal is to present the lines of the script and to explain their purpose. This way you can modify this example to meet your specific needs. The entire script will be included at the end of the article. Line numbers are included for reference and can be removed:

Line 1> @echo off

This line turns off sending results to the monitor. Logging is not enabled in this script, but it may be useful to redirect the output of this script to a text file.

Line 2> md c:\cmdtemp

This line creates a temporary CMD folder which will contain the installation files during the endpoint subscription process and then the contents and the folder will be deleted at the end of the script

Line 3> REM The following line needs to be modified to work in your environment.  What is below is just an example.

This is a comment line to remind you that Line 4 needs to be modified so that the UNC path matches your environment, specifically the location where the ShadowControl_Installer.msi file is located on your network. This will allow Line 4 to map a drive to that location with appropriate user credentials.

Line 4> net use x: \\fileserver\software\cmd /user:mydomain\deploy password

Line 5> copy x:\ShadowControl_Installer.msi c:\cmdtemp

This line copies the ShadowControl_Installer.msi file to the local temporary CMD folder

Line 6> msiexec /i “c:\cmdtemp\ShadowControl_Installer.msi” /qn /norestart

This line runs the msiexec tool with the install option (/i), with no UI (/qn), and with no restart after the installation completes (/norestart)

Line 7> net use /delete x:

Line 8> del c:\cmdtemp\ShadowControl_Installer.msi

Line 9> rmdir c:\cmdtemp

The following three lines do the cleanup work by releasing the mapped drive x: and deleting the contents of the temporary c:\cmdtemp folder and then removing the folder. At this point the endpoint agent should be successfully installed on the endpoint device. The next few lines are commented out in the script, but they provide an easy way to subscribe the endpoint device to the CMD server.

Line 11> cd “\program files (x86)\storagecraft\cmd” || cd “\program files\storagecraft\cmd”

Line 12> stccmd unsubscribe

Line 13> stccmd subscribe <appliance IP addr>

These three lines first change to the StorageCraft CMD program folder and then run the stccmd executable with an “unsubscribe” (clearing any existing subscriptions) before running the stccmd executable again with the “subscribe” option and the IP address of the CMD appliance. This will subscribe the endpoint device to the CMD appliance.

At this point you should have all of the tools to script the installation of CMD agents on endpoint devices and to subscribe those devices to your CMD appliance.

To get you started, we’ve included a download of the sample script below. You are welcome to modify this example any way you see fit. Please note that this is only an example of how this task may be accomplished. You are welcome to write your own scripts using elements of this example as you see fit.


[wpfilebase tag=file id=18 tpl=download-button /]