Changed Method for Determing Server Name

This commit is contained in:
Bob White 2018-02-26 12:09:11 -08:00
Родитель 44aad6ac0d
Коммит 5a3bde3ae4
1 изменённых файлов: 19 добавлений и 10 удалений

Просмотреть файл

@ -2,7 +2,7 @@
[CmdletBinding()]
param(
[parameter(Mandatory=$True, Position=1)]
[parameter(Mandatory=$false, Position=1)]
[ValidateNotNullOrEmpty()]
[string]$serverName,
@ -20,6 +20,13 @@ param(
)
$startTime = Get-Date
$Query = "SELECT SERVERPROPERTY('ServerName')"
$si = invoke-sqlcmd -Query $Query
$si = $si.Item(0)
$serverName = if([string]::IsNullOrEmpty($servername)) {$si}
#$Prompt= if ($Prompt -match '^y(es)?$') {'Y'} else {'N'}
@ -45,7 +52,9 @@ $Prompt = 'N'
$setupLog = "c:\tmp\setup_log.txt"
Start-Transcript -Path $setupLog -Append
$startTime = Get-Date
Write-Host -ForegroundColor 'Green' " Start time:" $startTime
Write-Host "Start time:" $startTime
Write-Host "ServerName set to $ServerName"
###These probably don't need to change , but make sure files are placed in the correct directory structure
@ -82,7 +91,7 @@ ELSE {Invoke-Expression $clone}
##If ($InstalR -eq 'Yes')
##{
Write-Host -ForeGroundColor magenta "Installing R Packages"
Write-Host "Installing R Packages"
Set-Location "C:\Solutions\$SolutionName\Resources\ActionScripts\"
# install R Packages
Rscript install.R
@ -95,7 +104,7 @@ Rscript install.R
Write-Host " Installing SQLServer Power Shell Module or Updating to latest "
Write-Host "Installing SQLServer Power Shell Module or Updating to latest "
if (Get-Module -ListAvailable -Name SQLServer) {Update-Module -Name "SQLServer"}
else
@ -116,7 +125,7 @@ If ($EnableFileStream -eq 'Yes')
{
Set-Location "C:\Program Files\Microsoft\ML Server\PYTHON_SERVER\python.exe"
.\setup.py install
Write-Host -ForeGroundColor cyan " Py Instal has been updated to latest version..."
Write-Host "Py Instal has been updated to latest version..."
}
@ -178,12 +187,12 @@ Invoke-Sqlcmd -Query $Query -ErrorAction SilentlyContinue
$ConfigureSql = "C:\Solutions\$SolutionName\Resources\ActionScripts\ConfigureSQL.ps1 $ServerName $SolutionName $InstallPy $InstallR $Prompt"
Invoke-Expression $ConfigureSQL
Write-Host -ForegroundColor 'Cyan' " Done with configuration changes to SQL Server"
Write-Host "Done with configuration changes to SQL Server"
Write-Host -ForeGroundColor cyan " Installing latest Power BI..."
Write-Host "Installing latest Power BI..."
# Download PowerBI Desktop installer
Start-BitsTransfer -Source "https://go.microsoft.com/fwlink/?LinkId=521662&clcid=0x409" -Destination powerbi-desktop.msi
@ -198,7 +207,7 @@ if (!$?) {
##Create Shortcuts and Autostart Help File
Copy-Item "$ScriptPath\$Shortcut" C:\Users\Public\Desktop\
Copy-Item "$ScriptPath\$Shortcut" "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp\"
Write-Host -ForeGroundColor cyan " Help Files Copied to Desktop"
Write-Host "Help Files Copied to Desktop"
$WsShell = New-Object -ComObject WScript.Shell
@ -250,9 +259,9 @@ Move-Item c:\tmp\server.js $SolutionPath\Website
$endTime = Get-Date
Write-Host -foregroundcolor 'green'(" $SolutionFullName Workflow Finished Successfully!")
Write-Host " $SolutionFullName Workflow Finished Successfully!"
$Duration = New-TimeSpan -Start $StartTime -End $EndTime
Write-Host -ForegroundColor 'green'(" Total Deployment Time = $Duration")
Write-Host " Total Deployment Time = $Duration"
Stop-Transcript