August 28, 2017 at 11:26 am
Hi
Does anyone works on SQL Server Named install using PowerShell using .ini files?
If you have any runnable script please share.
Basically want to have the flexibility of both default and named install based on switch option it will work accordingly.
Thanks.
August 28, 2017 at 12:57 pm
Here's one place to start: http://www.colinsalmcorner.com/post/install-and-configure-sql-server-using-powershell-dsc
Alan H
MCSE - Data Management and Analytics
Senior SQL Server DBA
Best way to ask a question: http://www.sqlservercentral.com/articles/Best+Practices/61537/
August 28, 2017 at 3:15 pm
Unable to hold the value from summry.txt file. Basically want to hold the value pf Final Results column to a variable to check if this Passed or Failed.
Please suggest how to write.
clear
Select-String -Path "C:\sql_test\Summary.txt" -Pattern "Final results:"
Thanks.
August 28, 2017 at 5:39 pm
You could do something like: $S = Select-String -Path "C:\sql_test\Summary.txt" -Pattern "Final"
Write-Host $S
It should work as select-string stops on the first match (unless you add -AllMatches).
Sue
August 28, 2017 at 5:50 pm
Hi Sue
I want to hold the value of the "Final Results" value coming from summary.txt file to a variable
If the key-value pair is Failed/other error, my build automation will not move further and break. But if this is Passed, it will go through.
Can you suggest how to tweak the code?
$S = Select-String -Path "C:\sql_test\Summary.txt" -Pattern "Final"
Write-Host $S
Thanks.
August 28, 2017 at 8:30 pm
$S = Select-String -Path "C:\sql_test\Summary.txt" -Pattern "Final Result:"
$S = $S.Line
$S = $S.Split(":")[1]
$S = $S.Trim()If ($S -eq "Passed")
{
write-host "Passed"
}
Else
{
write-host $S
}
Sue
August 28, 2017 at 9:00 pm
Sue_H - Monday, August 28, 2017 8:30 PMNot necessarily a good way since I only know some basics in Powershell but try something like this - grabs just line from the string, gets the string after the colon and then trims the whitespace:$S = Select-String -Path "C:\sql_test\Summary.txt" -Pattern "Final Result:"
$S = $S.Line
$S = $S.Split(":")[1]
$S = $S.Trim()If ($S -eq "Passed")
{
write-host "Passed"
}
Else
{
write-host $S
}Sue
Many thanks. Working as is. Did not knock my mind to check the
$S.line option.
Thanks.
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply