cohesity / cohesity-powershell-module

This repository provides a PowerShell Module for Cohesity DataPlatform. https://cohesity.github.io/cohesity-powershell-module
Apache License 2.0
42 stars 16 forks source link

Duplicate parameter error #221

Closed turanjl closed 1 year ago

turanjl commented 1 year ago

When running import-module cohesity.powershell, an error is logged for the restore-cohesityvmwarevm.ps1 script due to a duplicate parameter. The [switch]$overwriteexistingvm = $false is on both lines 63 & 90.

https://github.com/cohesity/cohesity-powershell-module/blob/ba8d3767d3f5d650a3fc19dcda94f99bfa2d6525/src/Cohesity.Powershell/Scripts/Restore/Restore-CohesityVMwareVM.ps1#L63

https://github.com/cohesity/cohesity-powershell-module/blob/ba8d3767d3f5d650a3fc19dcda94f99bfa2d6525/src/Cohesity.Powershell/Scripts/Restore/Restore-CohesityVMwareVM.ps1#L90

The same issue exists on lines 263 & 268.

https://github.com/cohesity/cohesity-powershell-module/blob/ba8d3767d3f5d650a3fc19dcda94f99bfa2d6525/src/Cohesity.Powershell/Scripts/Restore/Restore-CohesityVMwareVM.ps1#L263

https://github.com/cohesity/cohesity-powershell-module/blob/ba8d3767d3f5d650a3fc19dcda94f99bfa2d6525/src/Cohesity.Powershell/Scripts/Restore/Restore-CohesityVMwareVM.ps1#L268

Error output


C:\Program Files\WindowsPowerShell\Modules\Cohesity.powershell\1.8.5\Cohesity.PowerShell.psm1 : Failed to import
function C:\Program
Files\WindowsPowerShell\Modules\Cohesity.powershell\1.8.5\Scripts\Restore\Restore-CohesityVMwareVM.ps1: At C:\Program
Files\WindowsPowerShell\Modules\Cohesity.powershell\1.8.5\Scripts\Restore\Restore-CohesityVMwareVM.ps1:90 char:17
         [switch]$overwriteExistingVm = $false

Duplicate parameter $overwriteExistingVm in parameter list.
At C:\Program
Files\WindowsPowerShell\Modules\Cohesity.powershell\1.8.5\Scripts\Restore\Restore-CohesityVMwareVM.ps1:268 char:21
           overwriteExistingVm = $overwriteExistingVm.IsPres ...

Duplicate keys 'overwriteExistingVm' are not allowed in hash literals.
At line:1 char:1
 import-module Cohesity.powershell

     CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
     FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Cohesity.PowerShell.psm1
turanjl commented 1 year ago

Fix implemented