REST API Powershell - Add Client with ExecuteQCommand - Insufficient Arguments.XM

Last post 04-27-2018, 10:10 AM by FE54E. 1 replies.
Sort Posts: Previous Next
  • REST API Powershell - Add Client with ExecuteQCommand - Insufficient Arguments.XM
    Posted: 04-27-2018, 9:27 AM

    Hi,

    I try to add a client over the REST API with a Powershell call to the Commcell. 

    general QCommand is: 

    qoperation execute -af d:\scripts\addClient.xml -clientName dev-dehamor56 -hostName dev-dehamor56.int.kn -clientType UNIX

     

    I use thes Powershell REST API script:


    $body = @"
    command=qoperation execute -clientName dev-dehamor40 -hostName dev-dehamor40.int.kn -clientType UNIX, inputRequestXML="<App_CreatePseudoClientRequest>
    <clientInfo>
    <clientType>UNIX</clientType>
    <openVMSProperties>
    <cvdPort>0</cvdPort>
    </openVMSProperties>
    <ibmiInstallOptions/>
    </clientInfo>
    <entity>
    <clientName>dev-dehamor57</clientName>
    <hostName>dev-dehamor57.int.kn</hostName>
    </entity>
    <registerClient>false</registerClient>
    </App_CreatePseudoClientRequest>"
    "@

    $command = Invoke-WebRequest -Uri "$webServer/ExecuteQCommand" -Headers $headers -Method POST -Body $body -ContentType "application/x-www-form-urlencoded"
    $command
     
    ErrorMessage:
    {"errorMessage":"Error 0x302: Insufficient Arguments.XML File \u002f XML Tag is expected.

    Any idea about my syntax error?

     

    Thanks Robert

  • Re: REST API Powershell - Add Client with ExecuteQCommand - Insufficient Arguments.XM
    Posted: 04-27-2018, 10:10 AM

    Solved!

    just change the Uri: 

    $command = Invoke-WebRequest -Uri "$webServer/QCommand/qoperation execute" -Headers $headers -Method POST -Body $body 

     

    Change body to:

    $newclient = "dev-dehamor44"

    $body = "<App_CreatePseudoClientRequest>
    <clientInfo>
    <clientType>UNIX</clientType>
    <openVMSProperties>
    <cvdPort>0</cvdPort>
    </openVMSProperties>
    <ibmiInstallOptions/>
    </clientInfo>
    <entity>
    <clientName>$newclient</clientName>
    <hostName>$newclient.xxx.com</hostName>
    </entity>
    <registerClient>false</registerClient>
    </App_CreatePseudoClientRequest>"

The content of the forums, threads and posts reflects the thoughts and opinions of each author, and does not represent the thoughts, opinions, plans or strategies of Commvault Systems, Inc. ("Commvault") and Commvault undertakes no obligation to update, correct or modify any statements made in this forum. Any and all third party links, statements, comments, or feedback posted to, or otherwise provided by this forum, thread or post are not affiliated with, nor endorsed by, Commvault.
Commvault, Commvault and logo, the “CV” logo, Commvault Systems, Solving Forward, SIM, Singular Information Management, Simpana, Commvault Galaxy, Unified Data Management, QiNetix, Quick Recovery, QR, CommNet, GridStor, Vault Tracker, InnerVault, QuickSnap, QSnap, Recovery Director, CommServe, CommCell, SnapProtect, ROMS, and CommValue, are trademarks or registered trademarks of Commvault Systems, Inc. All other third party brands, products, service names, trademarks, or registered service marks are the property of and used to identify the products or services of their respective owners. All specifications are subject to change without notice.
Close
Copyright © 2019 Commvault | All Rights Reserved. | Legal | Privacy Policy