Mass Deployment Of Custom Commands

Is there a way to script/export/import some conf files or registry settings so that I can roll out custom commands to a large number of systems?  Entering them manually would be no fun.

  • When you say “custom commands”, do you mean the custom script that gets run by the up.time Agent for Custom Monitors or something else?  Which OS’s do you need to roll out to?

     

    Regards,

    Chris

  • Correct.  I can use my own distribution methods to put the actual scripts onto the monitored host (all Windows) but definined the name of the custom script and the location is currently being done by going to the Agent console on each individual system and entering it manually.  I’d like to be able to distribute via some automated method those script definitions into the agent settings.

  • You will want to create a .reg file to update the up.time registry key.  I’ll assume that the agent was installed remotely as well, therefore the agent password has not been set.  So, we need to set the CmdsPassword string under the up.time agent key and create a subkey, rexec_commands, where we will store the entries for each of the custom commands / scripts.

     

    Example .reg file:


    Windows Registry Editor Version 5.00

    [HKEY_LOCAL_MACHINESOFTWAREWow6432Nodeuptime softwareup.time agent]
    "CmdsPassword"="uptime"

    [HKEY_LOCAL_MACHINESOFTWAREWow6432Nodeuptime softwareup.time agentrexec_commands]
    "filedircheck"="cscript //nologo "C:Program Files (x86)uptime softwareup.time agentscriptsfiledircheck-win-agent.vbs""
    "CheckSchedTask"="cscript //nologo "C:Program Files (x86)uptime softwareup.time agentscriptsCheckSched.vbs""

    To load this .reg file on a remote server, you will need to use the PSexec tool which can be downloaded from http://technet.microsoft.com/en-ca/sysinternals/bb897553.aspx.

     

    The psexec command will look something like the example below.  It will connect to the remote server where the agent has already been installed and run the regedit to import the .reg file from a nework shared directory.

     


    > psexec /accepteula RemoteServer -u username -p password regedit /s HostnameSharedDircustom.reg

    Let me know if you have any issues.

     

    And for anyone else reading this thread, if you don’t have a tool to push the custom script on to the remote server, you can use psexec to do that too.


    > psexec /accepteula RemoteServer -u username -p password cmd /c mkdir "C:Program Files (x86)uptime softwareup.time agentscripts"
    > psexec /accepteula RemoteServer -u username -p password cmd /c copy HostnameSharedDirscript.vbs "C:Program Files (x86)uptime softwareup.time agentscripts"

    Regards,

    Chris

  • Thanks Chris – That’s just what I needed.  As an FYI for future Googler’s I found that Group Policy Preferences was a very effective way to accomplish this.  Using the “update” action on the registry keys and the “update” action to copy the files from a central repository to the local system.  I attached those GPP’s to my GPO that distributes the uptime agent.