I am trying to create a clearcase view using COM object in 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')
}
It throws following exception.
> 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
Can some one help me to solve this?
Try change these lines:
$ct.CmdExec("lsview $ViewName")
$ct.CmdExec("mkview -tag $ViewName -nsh $ViewFullpath")
Using ' $variable '
return the string $variable
Using " $variable "
return the value asign to the variable.
Told this, in your code, you can also change this:
$ViewFullpath="$ccViews$ViewName.vws"