## p4nuke ## aaron bockelie <# .SYNOPSIS Completely removes a user from a depot. Reverts files, removes from all groups, deletes all owned clientspecs, deletes user from depot and from primary auth group. .DESCRIPTION Ripley: I say we take off and nuke the entire site from orbit. It's the only way to be sure. .EXAMPLE p4nuke username .LINK http://www.youtube.com/watch?v=2s1MspmfEwg .PARAMETER username The user that will be completely removed. .FUNCTIONALITY As the function name and description suggest, please be careful with this command. #> Function p4nuke {param([Parameter(Mandatory = $true)]$username) $servercheck = p4get-server if ($servercheck.pingsuccess.equals($true)) { $message = "This will completely remove the user `'" + $username + "`' from the depot.`r`n`r`n`r`nIt`'s the only way to be sure." #warn user write-warning $message -warningaction Inquire $groups = p4get-group write-warning "Reverting all files that may be checked out" p4revert-user $username $clients = p4get-userclient $username write-warning ("Removing all clients owned by " + $username) foreach ($client in $clients) { p4remove-client $client.client } write-warning "Removing user from depot." p4remove-user $username write-warning "Removing user from all groups" foreach ($group in $groups) { p4remove-groupmember -users $username -group $group } } }#end function p4nuke
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 8410 | Aaron Bockelie |
Root checkin, Perforce Powershell wrapper. Still lots of work to be done, namely documentation and deployment tools, for instance, get-help needs work on the majority of these tools. Additionally, the /lib structure needs a little bit of condensation, probably into major groups (depot, userspec, clientspec, group management, and so on) that way function family can exist under each resource. |