testing boostrap-qs

This commit is contained in:
Manuel Romero
2020-06-17 16:00:27 +02:00
parent 7c5f2cb497
commit 75b10fbcc4
3 changed files with 18 additions and 10 deletions

View File

@@ -2,6 +2,8 @@ Param(
[string] $ModuleName = "vm-qs"
)
Write-Log "Current logged-on user: $env:USERNAME"
Write-Log "Resize Partition C to max size"
$size = Get-PartitionSupportedSize -DriveLetter C
Resize-Partition -DriveLetter C -Size $size.SizeMax | Out-Null

View File

@@ -114,7 +114,7 @@ resource "azurerm_windows_virtual_machine" "vm" {
}
inline = [
"powershell.exe -File C:/provision/resethostname.ps1",
"powershell.exe -File C:/provision/bootstrap-qs.ps1 -ModuleName vm-qs",
"powershell.exe -File C:/provision/gen-jwt.ps1"
]
}

View File

@@ -2,6 +2,8 @@ Param(
[string] $ModuleName = "vm-qs"
)
Write-Log "Current logged-on user: $env:USERNAME"
Write-Log "Resize Partition C to max size"
$size = Get-PartitionSupportedSize -DriveLetter C
Resize-Partition -DriveLetter C -Size $size.SizeMax | Out-Null
@@ -26,8 +28,8 @@ Set-Service -Name "QlikSenseSchedulerService" -StartupType Automatic
Set-Service -Name "QlikSenseRepositoryService" -StartupType Automatic
Set-Service -Name "QlikSenseRepositoryDatabase" -StartupType Automatic
Write-Log "Starting QlikSenseRepositoryDatabase and QlikSenseServiceDispatcher..."
Stop-Service QlikSenseRepositoryService
Start-Service QlikSenseRepositoryDatabase
Start-Service QlikSenseServiceDispatcher
@@ -40,21 +42,25 @@ $Certs = Get-ChildItem cert:"LocalMachine\My"
$Certs | %{Remove-Item -path $_.PSPath -recurse -Force}
$Certs = Get-ChildItem cert:"LocalMachine\Root" | Where-Object { $_.Subject -match 'GEN-QS' }
$Certs | %{Remove-Item -path $_.PSPath -recurse -Force}
$Certs = Get-ChildItem cert:"LocalMachine\Root" | Where-Object { $_.Subject -match 'QMI-QS' }
$Certs = Get-ChildItem cert:"LocalMachine\Root" | Where-Object { $_.Subject -match 'QMI' }
$Certs | %{Remove-Item -path $_.PSPath -recurse -Force}
Write-Log "Setting new hostname ($($env:computername)) in to Host.cfg file..."
$enchostname = [Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes("$($env:computername)"))
Set-Content -Path C:\ProgramData\Qlik\Sense\Host.cfg -Value $enchostname
Write-Log "Bootstraping Qlik Sense ..."
#$cred = New-Credential "qservice" "Qlik1234"
#Start-Process powershell.exe -Credential $cred -ArgumentList "Start-Process cmd.exe -Verb runAs -ArgumentList '/k C:\PROGRA~1\Qlik\Sense\Repository\Repository.exe -bootstrap -standalone -restorehostname'"
Write-Log "Bootstraping Qlik Sense for '$ModuleName'..."
if ( $ModuleName -ne "vm-qs" ) {
# The user executing this script is already 'qservice'
Start-Process powershell.exe -ArgumentList "Start-Process cmd.exe -Verb runAs -ArgumentList '/k C:\PROGRA~1\Qlik\Sense\Repository\Repository.exe -bootstrap -standalone -restorehostname'"
# AS if qservice user
Start-Process powershell.exe -ArgumentList "Start-Process cmd.exe -Verb runAs -ArgumentList '/k C:\PROGRA~1\Qlik\Sense\Repository\Repository.exe -bootstrap -standalone -restorehostname'"
} else {
# The user executing this script is NOT 'qservice'
$cred = New-Credential "qservice" "Qlik1234"
Start-Process powershell.exe -Credential $cred -ArgumentList "Start-Process cmd.exe -Verb runAs -ArgumentList '/k C:\PROGRA~1\Qlik\Sense\Repository\Repository.exe -bootstrap -standalone -restorehostname'"
}
$waiting=50
$waiting=20
Write-Log "Waiting $waiting secs ..."
Start-Sleep -s $waiting
@@ -73,7 +79,7 @@ $NewCerts = Get-ChildItem cert:"LocalMachine\Root" | Where-Object { $_.Subject -
if ($NewCerts) {
Write-Log "Restarting all Qlik Sense services"
Restart-Service QlikSenseServiceDispatcher -Force
#Restart-Service QlikSenseServiceDispatcher -Force
Restart-Service QlikLoggingService -Force
Restart-Service QlikSenseRepositoryService -Force
Restart-Service QlikSenseProxyService -Force