# p4logout # aaron bockelie <# .SYNOPSIS Logs the user out of the previously logged in depot. .DESCRIPTION This function logs the user out of any depot that is currently set by the p4 set command. It will also clear the environment variables set by p4login or p4loginhash. .EXAMPLE p4logout Logs the user out of the current depot and clears all assocaited variables set by p4login or p4loginhash. .FUNCTIONALITY Use this function when you are concluding issuing p4function commands for a given depot. #> Function p4logout #clears login token and unsets p4 sets for port and user { p4 logout $p4sysenv = Get-ItemProperty hkcu:\Software\Perforce\Environment if ($p4sysenv.P4PORT) { write-warning "Removing P4PORT variable from registry to complete logout." Remove-ItemProperty -Path hkcu:\Software\Perforce\Environment -Name P4PORT } if ($p4sysenv.P4USER) { write-warning "Removing P4USER variable from registry to complete logout." Remove-ItemProperty -Path hkcu:\Software\Perforce\Environment -Name P4USER } #clears all existing login tokens $env:p4logincall = $false $env:perforceport = $null $env:p4server = $null $env:p4passwd = $null $env:p4port=$null #set the server $env:p4user=$null #set the user }#end logout function.