Skip to content

Instantly share code, notes, and snippets.

@mwallner
Last active May 23, 2018 16:34
Show Gist options
  • Save mwallner/be55391823132a5cad28e9e6842d6a81 to your computer and use it in GitHub Desktop.
Save mwallner/be55391823132a5cad28e9e6842d6a81 to your computer and use it in GitHub Desktop.
"reorigin" accurev workspaces after hostname change
param(
$oldHostname
)
$erroractionpreference = "Stop"
[xml]$wspaces = accurev show wspaces -fx
$myFQDN=(Get-WmiObject win32_computersystem).DNSHostName+"."+(Get-WmiObject win32_computersystem).Domain
function ReOriginWS($wsname, $wsstorage) {
Write-Output " pulling workspace '$wsname' to '$myFQDN'"
Write-Output " > workspace path is '$wsstorage'"
accurev chws -w $wsname -l $wsstorage -m $myFQDN
}
Push-Location
try {
$wspaces.AcResponse.Element | Foreach-Object {
if (Test-Path $_.Storage) {
if (($_.Host -eq $oldHostname) -And ($_.Host -ne $myFQDN)) {
ReOriginWS $_.Name $_.Storage
}
}
}
} finally {
Pop-Location
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment