From 9f28c582381a29df1df7e6c45eb7037a7d9c9003 Mon Sep 17 00:00:00 2001 From: Daniel Michele Date: Thu, 22 Feb 2018 09:25:06 +0100 Subject: [PATCH] ExtensionInstallIndexingStatus.ps1: Fix broken script call PauseIndexing.ps1 ResumeIndexing.ps1: Allow to use SQLSERVER Module as well --- PauseIndexing.ps1 | 24 ++++++++++++++----- ResumeIndexing.ps1 | 24 ++++++++++++++----- .../ExtensionInstallIndexingStatus.ps1 | 2 +- 3 files changed, 37 insertions(+), 13 deletions(-) diff --git a/PauseIndexing.ps1 b/PauseIndexing.ps1 index 1b15cd2..119134b 100644 --- a/PauseIndexing.ps1 +++ b/PauseIndexing.ps1 @@ -12,17 +12,29 @@ Param( function ImportSQLModule { - $moduleCheck = Get-Module -List SQLPS + $moduleCheck = Get-Module -List SQLSERVER if($moduleCheck) { - Import-Module -Name SQLPS -DisableNameChecking - Write-Host "Loaded SQLPS module..." -ForegroundColor Green + Import-Module -Name SQLSERVER -DisableNameChecking + Write-Host "Loaded SQLSERVER module..." -ForegroundColor Green } else { - Write-Error "Cannot load module SQLPS. Please try from a machine running SQL Server 2012 or higher." - Pop-Location - exit + Write-Host "Cannot load module SQLSERVER. Trying to load SQLPS module." -ForegroundColor Yellow + + $moduleCheck = Get-Module -List SQLPS + + if($moduleCheck) + { + Import-Module -Name SQLPS -DisableNameChecking + Write-Host "Loaded SQLPS module..." -ForegroundColor Green + } + else + { + Write-Host "Cannot load SQLPS as well. Try running the script from a machine with SQL Server 2014 or higher installed or powershell 5.0" -ForegroundColor Red + Pop-Location + exit + } } } diff --git a/ResumeIndexing.ps1 b/ResumeIndexing.ps1 index e639c9f..bc32c64 100644 --- a/ResumeIndexing.ps1 +++ b/ResumeIndexing.ps1 @@ -26,17 +26,29 @@ function ResumeWorkItemIndexing function ImportSQLModule { - $moduleCheck = Get-Module -List SQLPS + $moduleCheck = Get-Module -List SQLSERVER if($moduleCheck) { - Import-Module -Name SQLPS -DisableNameChecking - Write-Host "Loaded SQLPS module..." -ForegroundColor Green + Import-Module -Name SQLSERVER -DisableNameChecking + Write-Host "Loaded SQLSERVER module..." -ForegroundColor Green } else { - Write-Error "Cannot load module SQLPS. Please try from a machine running SQL Server 2012 or higher." - Pop-Location - exit + Write-Host "Cannot load module SQLSERVER. Trying to load SQLPS module." -ForegroundColor Yellow + + $moduleCheck = Get-Module -List SQLPS + + if($moduleCheck) + { + Import-Module -Name SQLPS -DisableNameChecking + Write-Host "Loaded SQLPS module..." -ForegroundColor Green + } + else + { + Write-Host "Cannot load SQLPS as well. Try running the script from a machine with SQL Server 2014 or higher installed or powershell 5.0" -ForegroundColor Red + Pop-Location + exit + } } } diff --git a/TFS_2018RTW/ExtensionInstallIndexingStatus.ps1 b/TFS_2018RTW/ExtensionInstallIndexingStatus.ps1 index 089e562..074679f 100644 --- a/TFS_2018RTW/ExtensionInstallIndexingStatus.ps1 +++ b/TFS_2018RTW/ExtensionInstallIndexingStatus.ps1 @@ -60,7 +60,7 @@ function CodeExtensionInstallIndexingStatus } # Gets the data for repositories which are still inprogress. - $SqlFullPath = Join-Path $PWD -ChildPath 'SqlScripts\CodeIndexingInProgressRepositoryCount.sql' + $SqlFullPath = Join-Path $PWD -ChildPath 'SqlScripts\CodeBulkIndexingInProgressRepositoryCount.sql' $queryResults = Invoke-Sqlcmd -InputFile $SqlFullPath -serverInstance $SQLServerInstance -database $CollectionDatabaseName -Verbose -Variable $Params if($queryResults.ItemArray.Count -gt 0)