Last active
May 23, 2018 16:34
-
-
Save mwallner/be55391823132a5cad28e9e6842d6a81 to your computer and use it in GitHub Desktop.
"reorigin" accurev workspaces after hostname change
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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