Pregunta

Estoy tratando de crear una vista clara usando el objeto com en PowerShell.

$ccViews="\\Hostname.global.mycompany.com\cc-view\"
$ViewName="CodeCountView"
$ViewFullpath="$ccViews$ViewName"+".vws"

 $ct = new-object -com ClearCase.ClearTool

     try { 
         $ct.CmdExec('lsview $ViewName') 
     }
     catch {
         $ct.CmdExec('mkview -tag $ViewName -nsh $ViewFullpath')
      }

Lanza la siguiente excepción.

> Exception calling "CmdExec" with "1" argument(s): "storage directory
> must be in UNC style (e.g. \\host\share\...) " At
> E:\Powershellscripts\CCountAutomation.ps1:81 char:19
> +        $ct.CmdExec <<<< ('mkview -tag $ViewName -nsh $ViewFullpath')
>     + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
>     + FullyQualifiedErrorId : ComMethodTargetInvocation

¿Puede alguien ayudarme a resolver esto?

¿Fue útil?

Solución

Intente cambiar estas líneas:

$ct.CmdExec("lsview $ViewName") 

$ct.CmdExec("mkview -tag $ViewName -nsh $ViewFullpath")

Usando ' $variable ' devolver la variable de cadena $ usando " $variable " Devuelva el valor Asign a la variable.

Le dije a esto, en su código, también puede cambiar esto:

$ViewFullpath="$ccViews$ViewName.vws"

Otros consejos

Para agregar a la respuesta de los cristianos (votados), las tecnologías que encontré usan citas simples: SWG1PK70509

$ct.CmdExec('lsact -fmt `'%[crm_state]p`'

Pero cuando se usan variables, se requieren citas dobles, como se ilustra en "Cómo encontrar raíz [folder] Para cada componente usando cleartool?".

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top