From 584515143d8df4aae6513d9cfeb273312625d066 Mon Sep 17 00:00:00 2001 From: Russell Johnson Date: Thu, 10 Aug 2017 16:37:49 -0500 Subject: [PATCH] Fixed issue where default instance failed as the name would be truncated after the first character. --- Set-SqlStartupParameters.ps1 | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Set-SqlStartupParameters.ps1 b/Set-SqlStartupParameters.ps1 index 962bb66..f5a51bd 100644 --- a/Set-SqlStartupParameters.ps1 +++ b/Set-SqlStartupParameters.ps1 @@ -10,7 +10,14 @@ function Set-SQLStartupParameters{ #Loop through and change instances foreach($i in $Instance){ #Parse host and instance names - $HostName = ($i.Split('\'))[0] + if (($i.Split('\').count) -gt 1) + { + $HostName = ($i.Split('\'))[0] + } + else + { + $HostName = $i + } $InstanceName = ($i.Split('\'))[1] #Get service account names, set service account for change