4 Replies Latest reply on Nov 25, 2014 12:31 PM by Yanick Girouard

    CMD.exe Quotes, Spaces, parenthesis in Extended Objects

    James Donohue



      This is a recurring theme since I've started creating Extended Objects targeted for Windows Servers using cmd.exe. I've spent countless hours on every Extended Object I've created thus far because of SYNTAX issues! My latest is as follows:


      I have a cmd file that takes a parameter and runs another script based on the parameter. I started this EO using BSA Properties as parameters and six hours later I just hardcoded everything just to get it to work!


      This is my command line from the Command Window on my Windows Server:

      cmd /c ""C:\\Temp\\stage\\GWIM_BSA\\Extended_Objects""\\1-Common(All Windows) Configuration Items 1.0"\\"GET_Cert_Info.cmd" " 2008 R2"" 


      That works. Porting it to BSA does not work. I've tried using \ before every double-quote and also used ` and ^ and tried countless combinations of just quotes and it consistently stops at Objects. I've also tried using echo which I use in other EO's but that makes no difference either.


      Is there any Rhyme or reason to constructing a Windows based command line in BSA?


        • 1. Re: CMD.exe Quotes, Spaces, parenthesis in Extended Objects
          James Donohue

          Just to provide more info: Depending on how I construct it it also stops at the word Common and other combos just fail in general.

          • 2. Re: CMD.exe Quotes, Spaces, parenthesis in Extended Objects
            Yanick Girouard

            This is because you're looking at it all wrong. You shouldn't be trying to call a file that may not exist on the remote computer, because this means you need to copy this file first before the EO can work.


            Instead use scriptutil and make your EO use "Central Execution" instead of remote, then call it like so:


            scriptutil -h ??TARGET.NAME?? -s //fileserver/path/to/script.cmd -x "param1" "param 2 with spaces" "param3


            You just have to put the file on the file server in a directory of your choice. This will copy the script on demand in the staging directory (by default) of the target (defined in the STAGING_DIR server property), or you can overrule this by specifying the directory with the -d switch.

            • 3. Re: CMD.exe Quotes, Spaces, parenthesis in Extended Objects
              James Donohue

              Thanks Yanick. I tried that in my Extended Object but it doesn't seem to be able to find my source file on the Server.


              Here's the Error"


              Here's my EO:


              scriptutil -h ??TARGET.NAME?? -s "//Bladelogic/Depot/Applications/GWMT/Pilot (simulated ROOT)/Component Template Source Files/1-Windows_Common_Configuration-Items_1.0/GET_Cert_Info.cmd" -x "??TARGET.OS_VERSION??"

              • 4. Re: CMD.exe Quotes, Spaces, parenthesis in Extended Objects
                Yanick Girouard

                Where did you upload the script exactly? Also, please do not use spaces in the name and path of the script, it just complicates everything. Use underscores instead if you must, and I would remove the parenthesis from the directory name as well. Also, NSH is case sensitive for paths, unlike Windows, so make sure you're using the proper case.


                EDIT: Wait, I see what you did. The path of the script is not the path to get to the depot object/file in the console, but the actual physical NSH path on the file server. You'll need to manually upload the script using NSH or SSH (or a manual copy on Windows if your app server is running on Windows), in a directory you can access from NSH. Usually the BSA file server is preferred but it could be any server that all of your targets can reach over NSH.


                To know what the file server path is, go in Infrastructure Management, expand Application Servers, and click any of your app servers. Then look at the details on the right and you should see something like "File server root location = //fileserver/path/to/your/file_server"


                You need to upload the file manually to a folder on the file server, preferably outside of the root location (so you do not mix your files with BSA's).


                For example, our file server agent is named blfs, and our file server root is /BMC_Storage/fsroot. We created a directory in /BMC_Storage/extended_objects and this is where we upload our EO scripts: //blfs/BMC_Storage/extended_objects/