Skip to content

Instantly share code, notes, and snippets.

@tdewin
Last active December 6, 2017 12:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tdewin/49170354ceb08cdd73589ce228a57043 to your computer and use it in GitHub Desktop.
Save tdewin/49170354ceb08cdd73589ce228a57043 to your computer and use it in GitHub Desktop.
function start-vbomanuallmount {
if ($(Get-Module -Name Veeam.Archiver.PowerShell) -eq $null) {
$installpath = Get-ItemPropertyValue -Path 'HKLM:\SYSTEM\CurrentControlSet\Services\Veeam.Archiver.Service' -Name ImagePath -ErrorAction SilentlyContinue
if ($installpath -ne $null) {
$modulepath = Join-Path -Path (split-Path -Parent ($installpath -replace '"', "")) -ChildPath "Veeam.Archiver.PowerShell"
write-verbose "Loading VBO module from : $modulepath"
Import-module $modulepath
}
}
$prx = Get-VBOProxy
$repos = Get-VBORepository | select Name,@{E={$prxid=$_.proxyid;($prx | ? { $_.Id -eq $prxid}).Hostname};N="Proxy"},Path
write-host "######"
$repos | % { write-host ("{0,-30} | {1,-30} | {2,-50}" -f $_.Name,$_.Proxy,$_.Path)}
write-host "######"
$ps = @(get-process | ? { $_.Name -match "Veeam.Archiver.Shell" })
$r = $null
if ($ps -ne $null) {
$r = $ps[0].path
$ps | % {$p=$_;$p.kill()}
}
$vbos = get-service | ? { $_.name -match "veeam" -and $_.status -eq "running" }
$vbos | Stop-Service
$reposlocal = $repos | ? { $_.Proxy -eq $env:COMPUTERNAME }
$reposelect = $null
$ctlocal = @($reposlocal).Count
if($ctlocal -eq 1) {
$reposelect = $reposlocal
} elseif ($ctlocal -gt 1) {
$reposelect = $reposlocal | Out-GridView -Title "select repo" -OutputMode Single
}
$db = $null
if ($reposelect -ne $null) {
$dbs = Get-ChildItem $reposelect.path -Recurse -Filter "*.adb" | % { $_.FullName }
$ctdb = @($dbs).Count
if($ctdb -eq 1) {
$db = $dbs
} elseif ($ctdb -gt 1) {
$db = $dbs | Out-GridView -title "select db" -OutputMode Single
}
}
$explorer = Get-ItemPropertyValue -Path 'HKLM:\SOFTWARE\Classes\Veeam.Exchange.Explorer.edb\DefaultIcon' -Name "(Default)" -ErrorAction SilentlyContinue
if ($explorer -ne $null) {
if ($db -eq $null) {
Start-Process -FilePath $explorer -Wait
} else {
Start-Process -FilePath $explorer -ArgumentList @($db) -Wait
}
}
$vbos | start-service
if ($r -ne $null) {
Start-Process -FilePath $r
}
}
start-vbomanuallmount
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment