Skip to content

Commit dd1f32e

Browse files
2 parents 681cf61 + 3f4c50f commit dd1f32e

File tree

2 files changed

+25
-7
lines changed

2 files changed

+25
-7
lines changed

Test-OLA.ps1

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,17 +67,18 @@ Describe "Testing $Server Backup solution" {
6767
{
6868
$CheckForDBFolders -eq $true
6969
}
70-
}
71-
7270
if($Share.StartsWith('\\') -eq $False)
7371
{
7472
$UNC = $Share.Replace(':','$')
7573
$Root = '\\' + $ServerName + '\' + $UNC + '\' + $Folder
7674
}
7775
else
7876
{
79-
$Root = $Share + '\' + $Folder
77+
$Root = $Share + '\' + $Folder
8078
}
79+
}
80+
81+
8182

8283
Context "New Backup Jobs on $server" {
8384
It "Agent should be running" {
@@ -177,20 +178,37 @@ Describe "Testing $Server Backup solution" {
177178
}
178179
}
179180
}
180-
foreach($db in $dbs.Where{$_ -ne 'tempdb'})
181+
foreach($db in $dbs.Where{$_ -ne 'tempdb'})
181182
{
183+
182184
if($Srv.VersionMajor -ge 11)
183185
{
184186
If($srv.Databases[$db].AvailabilityGroupName)
185187
{
186188
$AG = $srv.Databases[$db].AvailabilityGroupName
187189
$Cluster = $srv.ClusterName
188190
$OLAAg = $Cluster + '$' + $AG
189-
$Root = $Share + '\' + $OlaAG
191+
if($Share.StartsWith('\\') -eq $False)
192+
{
193+
$UNC = $Share.Replace(':','$')
194+
$Root = '\\' + $ServerName + '\' + $UNC + '\' + $OlaAG
195+
}
196+
else
197+
{
198+
$Root = '\\' + $ServerName + '\' + $UNC + '\' + $Folder
199+
}
190200
}
191201
else
192202
{
193-
$Root = $Share + '\' + $Server
203+
if($Share.StartsWith('\\') -eq $False)
204+
{
205+
$UNC = $Share.Replace(':','$')
206+
$Root = '\\' + $ServerName + '\' + $UNC + '\' + $Folder
207+
}
208+
else
209+
{
210+
$Root = $Share + '\' + $Folder
211+
}
194212
}
195213
}
196214
$dbfoldername = $db.Replace(' ','')

Test-OLAInstance.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,11 @@ DontCheckJobOutcome = $DontCheckJobOutcome }
110110
if($Report)
111111
{
112112
$Date = Get-Date -Format ddMMyyyHHmmss
113+
$tempFolder = 'c:\temp'
113114
$File = $tempFolder + '\Script_Pester_Report_' + $date
114115
$XML = $File + '.xml'
115116
$HTML = $file + '.html'
116117
Invoke-Pester -Script $Script -OutputFile $xml -OutputFormat NUnitXml
117-
$tempFolder = 'c:\temp'
118118
Push-Location $tempFolder
119119
#download and extract ReportUnit.exe
120120
$url = 'http://relevantcodes.com/Tools/ReportUnit/reportunit-1.2.zip'

0 commit comments

Comments
 (0)