Skip to content

Commit 6ebe6e0

Browse files
committed
01 Server Resource - strictmode fixes
copyobjects function - ignore schema on non-table objects
1 parent 446938b commit 6ebe6e0

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

Scripts/01_Server_Resource_Governor.ps1

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,13 @@ function CopyObjectsToFiles($objects, $outDir) {
105105

106106
$schemaPrefix = ""
107107

108-
if ($o.Schema -ne $null -and $o.Schema -ne "") {
109-
$schemaPrefix = $o.Schema + "."
110-
}
108+
try
109+
{
110+
if ($o.Schema -ne $null -and $o.Schema -ne "") {
111+
$schemaPrefix = $o.Schema + "."
112+
}
113+
}
114+
catch {}
111115

112116
$fixedOName = $o.name.replace('\','_')
113117
$scripter.Options.FileName = $outDir + $schemaPrefix + $fixedOName + ".sql"
@@ -200,10 +204,8 @@ try
200204
{
201205
# Pools
202206
$pools = $srv.ResourceGovernor.ResourcePools | where-object -FilterScript {$_.Name -notin "internal","default"}
203-
if ($pools.Count -gt 0)
204-
{
205-
CopyObjectsToFiles $pools $output_path
206-
}
207+
CopyObjectsToFiles $pools $output_path
208+
207209

208210
# Workgroups
209211
foreach ($pool in $pools)

0 commit comments

Comments
 (0)