How can i modify vob group in clearcase in windows? - clearcase

My views are in none group but user and administrator is in clearcase group.so I am not able to access my vob in view server. How can i change my view group?

You would need to use fix_prot: see "How to change the group name in view dir (*.vws) since primary group in pvob is changed?"
fix_prot [–f/orce] { –root [–r/ecurse] [–recover {–chown user | –chgrp group } |
–replace/_server_process_group| [–r/ecurse] [–type { d | f }]
[–chown user] [–chgrp group] [–chmod permissions] } pname …
I usually define an alias first:
doskey fp=c:\Rational\ClearCase\etc\utils\fix_prot.exe -force -chgrp "TheNewGroup" -chown yourID $*
And then change the view properties:
fp -rec -chmod 775 \\path\to\view\storage\yourID\yourView.vws
fp -root \\path\to\view\storage\yourID\yourView.vws
Or, without the doskey (Windows alias):
c:\Rational\ClearCase\etc\utils\fix_prot.exe -force -chgrp "TheNewGroup" -chown yourID $* -rec -chmod 775 \\path\to\view\storage\yourID\yourView.vws
c:\Rational\ClearCase\etc\utils\fix_prot.exe -force -chgrp "TheNewGroup" -chown yourID $* -root \\path\to\view\storage\yourID\yourView.vws

Related

Not able to checkout elements in stream in ClearCase

I am not able to checkout any element in Dev stream in Clearcase from any user except the admin user. I am getting below error :
No permission to perform operation "checkout".
Must be one of: member of object group, object owner, VOB owner, member of admin group.
I added the user group to the Primary group of clearcase in Windows, but I am still facing same issue.
Assuming a regular ClearCase (not CCRC with automatic or web view), type in your view:
cleartool lsview -l -full -pro -cview
Check if if the primary group is correct.
If not, take note of the global path (which should be like an network UNC path \\<aServer>\path\to\view\storage.
If not, in a regular CMD session:
set CLEARCASE_PRIMARY_GROUP=<aGroup>
doskey fp=c:\Rational\ClearCase\etc\utils\fix_prot.exe -force -chgrp "<aGroup>" -chown <aLogin> $*
fp -rec -chmod 775 \\UNC\Path\to\view.vws
fp -root \\UNC\Path\to\view.vws
Replace \\UNC\Path\to\view.vws by the global path you have seen in the first step (the lsview one), as mentioned above.
Replace <aGroup> by the primary group name, and <aLogin> by your Windows login.
Make sure your user is part of that group.

ClearCase view visible with lsview, nonexistent for catcs

**On a machine I'm working on, there's this view we shall call magic_view - which exhibits the following strange behavior:
$ ct lsview magic_view
magic_view /view_store/our_team_vws/magic_view.vws
$ ct catcs -tag magic_view
ct: Error: View tag "magic_view": ClearCase object not found
Now, magic_view was not created by me, so I'm guessing something strange happened to it. But - what? What could cause a view to be visible for lsview but unknown for catcs?
That means the view has been registered (cleartool register -view)
But its tag has not been declared (cleartool mktag -view)
cleartool register -view -replace -host newhost -hpath hpath/xxx.vws /hpath/xxx.vws
ct mktag -view -replace -tag tag -host newhost -gpath gpath gpath
The tag part of this picture is missing in your case:
You can see more cleartool mktag -view examples here.
Its tag might be missing from the client region:
Example: to create a windows tag from a UNIX server, for a ClearCase View with its view storage on a NAS device:
cleartool mktag -view -tag samecs_view -region samecs_win -host view_server_host.samecs.com \
-gpath "\\\\samecs\\ccviewstore \\gbush_view.vws" \
-hpath "\\\\samecs\\ccviewstore \\gbush_view.vws" \
/net/samecs/ccviewstore/gbush_view.vws
As Brian Cowan adds in the comments, using the rgy_check command can help.
That will tell you about cc registry issues.
At one time, there were issues getting the configspec of snapshot views if you weren't actually IN the view, but that currently works.

Windows Powershell: Display File Path along with Name and LastWriteTime

I'm using a Windows Powershell code that is very good but with one caveat. See below:
PS F:\Bizfi> dir -r | Out-GridView | Select FullName, LastWriteTime
The caveat is that it does not display the file path. Is there a way to include the file path within the name or as a separate property?
Thanks
If you want to mimic normal Get-ChildItem output:
dir -r | Select Mode,LastWriteTime,Length,Name,Fullname | Out-GridView

How to change the group name in view dir (*.vws) since primary group in pvob is changed?

I have a problem changing the group name in (*.vws) directory of the view since the cc primary group is changed on Pvob. It is not blocking me since I am the owner but my collegue is not been able to deliver in my view.
Thanks for any help
I usually use fix_prot (see "About fix_prot")
On Windows:
doskey fp=c:\Rational\ClearCase\etc\utils\fix_prot.exe -force -chgrp "TheNewGroup" -chown yourID $*
fp -rec -chmod 775 \\path\to\view\storage\yourID\yourView.vws
fp -root \\path\to\view\storage\yourID\yourView.vws
On Unix:
alias fp=/path/to/ClearCase/etc/utils/fix_prot -force -chgrp "TheNewGroup" -chown yourID
fp -rec -chmod 775 /path/to/view/storage/yourID\yourView.vws
fp -root /path/to/view/storage/yourID/yourView.vws
Note that if the group of the PVob has changed, you might have to change the group of the project, stream and associated branch as well.
cleartool protect -chgrp "YourNewGroup" stream:yourStream#\aPVob

Get file version in PowerShell

How can you get the version information from a .dll or .exe file in PowerShell?
I am specifically interested in File Version, though other version information (that is, Company, Language, Product Name, etc.) would be helpful as well.
Since PowerShell 5 in Windows 10, you can look at FileVersionRaw (or ProductVersionRaw) on the output of Get-Item or Get-ChildItem, like this:
(Get-Item C:\Windows\System32\Lsasrv.dll).VersionInfo.FileVersionRaw
It's actually the same ScriptProperty from my Update-TypeData in the original answer below, but built-in now.
In PowerShell 4, you could get the FileVersionInfo from Get-Item or Get-ChildItem, but it would show the original FileVersion from the shipped product, and not the updated version. For instance:
(Get-Item C:\Windows\System32\Lsasrv.dll).VersionInfo.FileVersion
Interestingly, you could get the updated (patched) ProductVersion by using this:
(Get-Command C:\Windows\System32\Lsasrv.dll).Version
The distinction I'm making between "original" and "patched" is basically due to the way the FileVersion is calculated (see the docs here). Basically ever since Vista, the Windows API GetFileVersionInfo is querying part of the version information from the language neutral file (exe/dll) and the non-fixed part from a language-specific mui file (which isn't updated every time the files change).
So with a file like lsasrv (which got replaced due to security problems in SSL/TLS/RDS in November 2014) the versions reported by these two commands (at least for a while after that date) were different, and the second one is the more "correct" version.
However, although it's correct in LSASrv, it's possible for the ProductVersion and FileVersion to be different (it's common, in fact). So the only way to get the updated Fileversion straight from the assembly file is to build it up yourself from the parts, something like this:
Get-Item C:\Windows\System32\Lsasrv.dll | ft FileName, File*Part
Or by pulling the data from this:
[System.Diagnostics.FileVersionInfo]::GetVersionInfo($this.FullName)
You can easily add this to all FileInfo objects by updating the TypeData in PowerShell:
Update-TypeData -TypeName System.IO.FileInfo -MemberName FileVersionRaw -MemberType ScriptProperty -Value {
[System.Diagnostics.FileVersionInfo]::GetVersionInfo($this.FullName) | % {
[Version](($_.FileMajorPart, $_.FileMinorPart, $_.FileBuildPart, $_.FilePrivatePart)-join".")
}
}
Now every time you do Get-ChildItem or Get-Item you'll have a FileVersionRaw property that shows the updated File Version ...
Since PowerShell can call .NET classes, you could do the following:
[System.Diagnostics.FileVersionInfo]::GetVersionInfo("somefilepath").FileVersion
Or as noted here on a list of files:
get-childitem * -include *.dll,*.exe | foreach-object { "{0}`t{1}" -f $_.Name, [System.Diagnostics.FileVersionInfo]::GetVersionInfo($_).FileVersion }
Or even nicer as a script: https://jtruher3.wordpress.com/2006/05/14/powershell-and-file-version-information/
'dir' is an alias for Get-ChildItem which will return back a System.IO.FileInfo class when you're calling it from the filesystem which has VersionInfo as a property. So ...
To get the version info of a single file do this:
PS C:\Windows> (dir .\write.exe).VersionInfo | fl
OriginalFilename : write
FileDescription : Windows Write
ProductName : Microsoft® Windows® Operating System
Comments :
CompanyName : Microsoft Corporation
FileName : C:\Windows\write.exe
FileVersion : 6.1.7600.16385 (win7_rtm.090713-1255)
ProductVersion : 6.1.7600.16385
IsDebug : False
IsPatched : False
IsPreRelease : False
IsPrivateBuild : False
IsSpecialBuild : False
Language : English (United States)
LegalCopyright : © Microsoft Corporation. All rights reserved.
LegalTrademarks :
PrivateBuild :
SpecialBuild :
For multiple files this:
PS C:\Windows> dir *.exe | %{ $_.VersionInfo }
ProductVersion FileVersion FileName
-------------- ----------- --------
6.1.7600.16385 6.1.7600.1638... C:\Windows\bfsvc.exe
6.1.7600.16385 6.1.7600.1638... C:\Windows\explorer.exe
6.1.7600.16385 6.1.7600.1638... C:\Windows\fveupdate.exe
6.1.7600.16385 6.1.7600.1638... C:\Windows\HelpPane.exe
6.1.7600.16385 6.1.7600.1638... C:\Windows\hh.exe
6.1.7600.16385 6.1.7600.1638... C:\Windows\notepad.exe
6.1.7600.16385 6.1.7600.1638... C:\Windows\regedit.exe
6.1.7600.16385 6.1.7600.1638... C:\Windows\splwow64.exe
1,7,0,0 1,7,0,0 C:\Windows\twunk_16.exe
1,7,1,0 1,7,1,0 C:\Windows\twunk_32.exe
6.1.7600.16385 6.1.7600.1638... C:\Windows\winhlp32.exe
6.1.7600.16385 6.1.7600.1638... C:\Windows\write.exe
I realise this has already been answered, but if anyone's interested in typing fewer characters, I believe this is the shortest way of writing this in PS v3+:
ls application.exe | % versioninfo
ls is an alias for Get-ChildItem
% is an alias for ForEach-Object
versioninfo here is a shorthand way of writing {$_.VersionInfo}
The benefit of using ls in this way is that you can easily adapt it to look for a given file within subfolders. For example, the following command will return version info for all files called application.exe within subfolders:
ls application.exe -r | % versioninfo
-r is an alias for -Recurse
You can further refine this by adding -ea silentlycontinue to ignore things like permission errors in folders you can't search:
ls application.exe -r -ea silentlycontinue | % versioninfo
-ea is an alias for -ErrorAction
Finally, if you are getting ellipses (...) in your results, you can append | fl to return the information in a different format. This returns much more detail, although formatted in a list, rather that on one line per result:
ls application.exe -r -ea silentlycontinue | % versioninfo | fl
fl is an alias for Format-List
I realise this is very similar to xcud's reply in that ls and dir are both aliases for Get-ChildItem. But I'm hoping my "shortest" method will help someone.
The final example could be written in long-hand in the following way:
Get-ChildItem -Filter application.exe -Recurse -ErrorAction SilentlyContinue | ForEach-Object {$_.VersionInfo} | Format-List
... but I think my way is cooler and, for some, easier to remember. (But mostly cooler).
I prefer to install the PowerShell Community Extensions and just use the Get-FileVersionInfo function that it provides.
Like so:
Get-FileVersionInfo MyAssembly.dll
with output like:
ProductVersion FileVersion FileName
-------------- ----------- --------
1.0.2907.18095 1.0.2907.18095 C:\Path\To\MyAssembly.dll
I've used it against an entire directory of assemblies with great success.
Just another way to do it is to use the built-in file access technique:
(get-item .\filename.exe).VersionInfo | FL
You can also get any particular property off the VersionInfo, thus:
(get-item .\filename.exe).VersionInfo.FileVersion
This is quite close to the dir technique.
This is based on the other answers, but is exactly what I was after:
(Get-Command C:\Path\YourFile.Dll).FileVersionInfo.FileVersion
[System.Diagnostics.FileVersionInfo]::GetVersionInfo("Path\To\File.dll")
I find this useful:
function Get-Version($filePath)
{
$name = #{Name="Name";Expression= {split-path -leaf $_.FileName}}
$path = #{Name="Path";Expression= {split-path $_.FileName}}
dir -recurse -path $filePath | % { if ($_.Name -match "(.*dll|.*exe)$") {$_.VersionInfo}} | select FileVersion, $name, $path
}
As EBGreen said, [System.Diagnostics.FileVersionInfo]::GetVersionInfo(path) will work, but remember that you can also get all the members of FileVersionInfo, for example:
[System.Diagnostics.FileVersionInfo]::GetVersionInfo(path).CompanyName
You should be able to use every member of FileVersionInfo documented here, which will get you basically anything you could ever want about the file.
Here an alternative method. It uses Get-WmiObject CIM_DATAFILE to select the version.
(Get-WmiObject -Class CIM_DataFile -Filter "Name='C:\\Windows\\explorer.exe'" | Select-Object Version).Version

Resources