Commvault / CVPowershellSDK

Developer SDK - Powershell
12 stars 12 forks source link

Message: The remote server returned an error: (500) Internal Server Error. #45

Closed liorkrispin closed 7 months ago

liorkrispin commented 11 months ago

got error when run the next code powershell

$requestbody = @' { "destinationClient": { "clientName": "clientName" }, "destinationInfo": [ { "vmware": { "esxHost": "ESX", "newName": "BLABLA", "dataStore": "VMFS", "resourcePool": "/" } } ] } '@ | ConvertFrom-Json

Restore-CVVirtualMachine -Name VM1-ClientName VC -SubclientName VC-outofPlace -Requestbody $requestbody -OverwriteExisting

JnaneshD commented 11 months ago

Hi @liorkrispin ,

Could you please elaborate on this issue? Is the payload correct?

Please paste the WebServer.log for this API request.

liorkrispin commented 10 months ago

sorry, this is my code:

$requestbody = @' { "destinationClient": { "clientName": "vcenter" }, "destinationInfo": [ { "vmware": { "esxHost": "ESXiHost", "newName": "new for |VM", "dataStore": "DATASTORE", "resourcePool": "/" } } ] } '@ | ConvertFrom-Json

Restore-CVVirtualMachine -Name SOURCE VM-ClientName vcenter -SubclientName Subclient -outofPlace -Requestbody $requestbody -OverwriteExisting

here is the error:

Are you sure you want to perform this action? Performing the operation "Restore-CVVirtualMachine" on target "SOURCEVM". [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): A ValidateResponse : Status: ProtocolError Message: The remote server returned an error: (500) Internal Server Error. ErrorMessage: RecommendedAction: At C:\Program Files\WindowsPowerShell\Modules\Commvault.RESTSession\2.0.22\Commvault.RESTSession.psm1:465 char:17

JnaneshD commented 10 months ago

If there is a space in the name of the VM , can we please use it via the variables and try?

$sourceVM = 'SOURCE VM'
Restore-CVVirtualMachine -Name $sourceVM -ClientName vcenter -SubclientName Subclient -outofPlace -Requestbody $requestbody -OverwriteExisting

Could you please share the log file -> WebServer.log when running this command?

JnaneshD05 commented 7 months ago

Archiving this issue