Advertisement
Guest User

Untitled

a guest
Sep 26th, 2016
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function Install-VBRServer
  2. {
  3.         param (
  4.         [Parameter(Mandatory=$True)]
  5.         [string]$Path,
  6.         [string]$SQLServer,
  7.         [switch]$SQLAuth,
  8.         [string]$Username,
  9.         [string]$Password,  
  10.         [string]$Licence
  11.     )
  12.  
  13.     Write-Host "Installing VBRServer..."
  14.    
  15.     $SQLAuthParam = $null
  16.  
  17.     if ($SQLServer)
  18.     {
  19.         $SQLServer = ('VBR_SQLSERVER_SERVER="' + $SQLServer + '"')
  20.     }
  21.     if ($SQLAuth)
  22.     {
  23.         $SQLAuthParam = 'VBR_SQLSERVER_AUTHENTICATION="1"'
  24.     }
  25.     if ($Username)
  26.     {
  27.         $Username = ('VBR_SQLSERVER_USERNAME="'+ $Username +'"')
  28.     }
  29.     if ($Password)
  30.     {
  31.         $Password = ('VBR_SQLSERVER_PASSWORD="' + $Password +  '"' )
  32.     }
  33.  
  34.     $VBRMsiPath =(Join-Path -Path $Path -ChildPath "Backup\Server.x64.msi")
  35.     $Logpath = New-InstallationLogsFolder
  36.     if ($Licence)
  37.     {
  38.         $LocalLicencePath = Join-Path -Path $Logpath -ChildPath "Licence.lic"
  39.         Copy-Item -Path $Licence -Destination $LocalLicencePath
  40.         $Licence = ('VBR_LICENSE_FILE="' + $LocalLicencePath + '"')
  41.     }
  42.  
  43.     & msiexec /L*v $Logpath\VBRServer.log /qn /i $VBRMsiPath ACCEPTEULA="YES" $SQLServer $SQLAuthParam $Username $Password $Licence | Out-Null
  44.  
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement