Skip to content
Permalink
Browse files

change the way the pre adn post importscripts are run on linux #620

  • Loading branch information...
SQLDBAWithABeard committed May 31, 2019
1 parent 411a07e commit 2e3d47c5ea7b4c88637586cad2420e587f0bcee6
Showing with 15 additions and 3 deletions.
  1. +15 −3 dbachecks.psm1
@@ -1,4 +1,5 @@
$script:ModuleRoot = $PSScriptRoot $script:ModuleRoot = $PSScriptRoot
$VerbosePreference = "Continue"


function Import-ModuleFile { function Import-ModuleFile {
[CmdletBinding()] [CmdletBinding()]
@@ -25,7 +26,13 @@ if ((Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\WindowsPowerShell\dbacheck
if ((Get-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\WindowsPowerShell\dbachecks\System" -Name "DoDotSource" -ErrorAction Ignore).DoDotSource) { $script:doDotSource = $true } if ((Get-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\WindowsPowerShell\dbachecks\System" -Name "DoDotSource" -ErrorAction Ignore).DoDotSource) { $script:doDotSource = $true }


# Execute Preimport actions # Execute Preimport actions
. Import-ModuleFile -Path "$ModuleRoot\internal\scripts\preimport.ps1" if($IsLinux){
Write-Verbose "Loading preimport in linux"
. Import-ModuleFile -Path "$ModuleRoot/internal/scripts/preimport.ps1"
}else{
. Import-ModuleFile -Path "$ModuleRoot\internal\scripts\preimport.ps1"
}



# Import all internal functions # Import all internal functions
foreach ($function in (Get-ChildItem "$ModuleRoot\internal\functions\*.ps1")) { foreach ($function in (Get-ChildItem "$ModuleRoot\internal\functions\*.ps1")) {
@@ -38,7 +45,12 @@ foreach ($function in (Get-ChildItem "$ModuleRoot\functions\*.ps1")) {
} }


# Execute Postimport actions # Execute Postimport actions
. Import-ModuleFile -Path "$ModuleRoot\internal\scripts\postimport.ps1" if($IsLinux){
Write-Verbose "Loading postimport in linux"
. Import-ModuleFile -Path "$ModuleRoot/internal/scripts/postimport.ps1"
}else{
. Import-ModuleFile -Path "$ModuleRoot\internal\scripts\postimport.ps1"
}


if (-not (Test-Path Alias:Update-Dbachecks)) { Set-Alias -Scope Global -Name 'Update-Dbachecks' -Value 'Update-DbcRequiredModules' } if (-not (Test-Path Alias:Update-Dbachecks)) { Set-Alias -Scope Global -Name 'Update-Dbachecks' -Value 'Update-DbcRequiredModules' }

$VerbosePreference = "SilentlyContinue"

0 comments on commit 2e3d47c

Please sign in to comment.
You can’t perform that action at this time.