Permalink
Browse files

added error handling

  • Loading branch information...
SQLDBAWithABeard committed Aug 28, 2018
1 parent 4a2f639 commit 8954cbfccf9d77d3cacb93fe27039a80a71eeb6d
Showing with 8 additions and 1 deletion.
  1. +8 −1 dbachecks.psm1
@@ -8,7 +8,14 @@ function Import-ModuleFile {
)

if ($doDotSource) { . $Path }
else { $ExecutionContext.InvokeCommand.InvokeScript($false, ([scriptblock]::Create([io.file]::ReadAllText($Path))), $null, $null) }
else {
try {
$ExecutionContext.InvokeCommand.InvokeScript($false, ([scriptblock]::Create([io.file]::ReadAllText($Path))), $null, $null)
}
catch {
Write-Warning "Failed to import $Path"
}
}
}

# Detect whether at some level dotsourcing was enforced

0 comments on commit 8954cbf

Please sign in to comment.