## p4get-useropenfiles ## aaron bockelie <# .SYNOPSIS Returns all open files on all clientspecs for a given user. .DESCRIPTION This function returns an array of all opened files on all clientspecs for a given user as a powershell object. .EXAMPLE This example returns all files for the user 'p4infosysadmin' [PS] p4get-useropenfiles p4infosysadmin client openedfiles ------ -------- voltron2 {@{depotFile=//depot/servi... voltron3 {@{depotFile=//depot/servi... The returned object contains the following objects: revertcomplete: a boolean value returning the status of the command. This is false if there are any files not reverted. client: the name of the client operated against. notreverted: an array of depot files that could not be reverted. reverted: an array of depot files that were successfully reverted. .PARAMETER username The user you'd like to get a report on. .FUNCTIONALITY This function simplifies the overhead of listing files for a given user. #> Function p4get-useropenfiles {param([Parameter(Mandatory = $true)]$username) $servercheck = p4get-server if ($servercheck.pingsuccess.equals($true)) { $result = @() $clientlist = p4get-userclient $username if ($clientlist -eq $null) { write-error "No clients found!" -category ObjectNotFound } else { foreach ($clientobject in $clientlist) { try { $result += p4get-clientopenfiles $clientobject.client } catch { resolve-error $message = "An error occured returning files on client `'" + $clientobject.client + "`'" write-error $message } } } } return $result }#end function p4get-useropenfiles