Blame | Last modification | View Log | RSS feed
# This script will:# Locate Repos on Master# Identify those that have not been converted to VFDS and convert them# Identify those that have not been replicated to this machine# Create a local Replica#$MasterServer = "auperasvn01.vix.local"$mySID = "S-1-5-21-719430368-289315701-3495892327-45610"# euawsasvn001 S-1-5-21-719430368-289315701-3495892327-34395# auawsasvn001 S-1-5-21-719430368-289315701-3495892327-45610$repoList = @()Function SetUpRepoSync($repository){$repoName = $repository.NameWrite-Host "Processing: ", $repoName$ab = Get-WmiObject -Namespace "root\VisualSVN" -ClassName VisualSVN_Repository | where { $_.name -eq $repoName }if ( $ab ){Write-Host ("Local Repo found - not processed")}else{Write-Host ("Sync Repo:", $repoName)$settings = Invoke-CimMethod $repository -MethodName GetReplicationSettings#$settings$settings.Enabled = $true$acc1 = New-CimInstance -ClientOnly -Namespace root/visualsvn -ClassName VisualSVN_WindowsAccount -Property @{SID = $mySID }[System.Collections.ArrayList] $replicators = $settings.Replicators$replicators.Add($acc1)[CimInstance[]] $newReplicators = $replicators.ToArray()Invoke-CimMethod $repository -MethodName SetReplicationSettings -Arguments @{Enabled= $settings.Enabled; Replicators = $newReplicators }Invoke-CimMethod -Namespace root\VisualSVN -ClassName VisualSVN_Repository -MethodName CreateVdfsSlave -Arguments @{ Name = $repoName; MasterServer = $MasterServer; MasterRepository = $repoName }}}Function ConvertRepo($repository){$repoName = $repository.NameWrite-Host "Convert Repo: ", $repoName$rv = Invoke-CimMethod $repository -MethodName ConvertToVdfs$rvif ( $rv.ReturnValue -ne "0" ){Write-Host "Error converting Repo:", $repoName}}Get-CimInstance -ComputerName $MasterServer -Namespace "root\VisualSVN" -ClassName VisualSVN_Repository | ForEach-Object {Write-Host "Name", $_.name, "Type:", $_.Type# Only process Master VFDS repos# Type of repository: 0 - FSFS, 1 - VDFS (master), 2 - VDFS (slave)# - Ignore Slaves# - Ignore non VFDS reposif ( $_.type -eq "1" ){Write-Host "Will be processed", $_.nameSetUpRepoSync $_}if ( $_.type -eq "0" ){Write-Host "Will be Converted", $_.nameConvertRepo $_#exit}}