Skip to content

Commit ff655b8

Browse files
authored
fix unassigned servername, github issue 150 (#153)
1 parent b15fe2e commit ff655b8

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

SMO_DDL.ps1

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,10 @@ Function GenerateDDL-DB {
213213

214214
# Get some info on the SQL Server instance to include in the Babelfisn Compass report
215215
$SrvResourceTag = "SMO_DDL SQL Server info:" # do not change this string, or the variable name below!
216-
$SQLSrvName = $($MyServer.NetName)
216+
$SQLSrvName = $($MyServer.NetName)
217+
if ($SQLSrvName -eq $null -or $SQLSrvName -eq '') {
218+
$SQLSrvName = $Servername
219+
}
217220
Write-Output "`n--SQL Server Information generated by SMO_DDL.ps1 (do not change these lines):`n" | Add-Content -Path $DDLFilename
218221
Write-Output "DECLARE @srvinfo VARCHAR(MAX)" | Add-Content -Path $DDLFilename
219222
Write-Output "SET @srvinfo = '$SrvResourceTag $($SQLSrvName):Edition=$($MyServer.Edition)'" | Add-Content -Path $DDLFilename

0 commit comments

Comments
 (0)