-
Notifications
You must be signed in to change notification settings - Fork 226
Description
Details of the scenario you try and problem that is occurring:
When PowerShell 4,0 is installed calling Invoke-Sqlcmd
from the helper function Invoke-SqlScript
fails.
See more detailed explanation here:
#252 (comment)
If there is no solution to running this resource using PowerShell 4.0, then as a minimum we have to document in the README.md that this is PowerShell 5.0 only.
The DSC configuration that is using the resource (as detailed as possible):
Configuration
xSQLServerScript 'SQL2014-RunSQLScript'
{
ServerInstance = 'sqltest3.company.local\SQL2014'
SetFilePath = 'C:\DSCTemp\SQLScripts\Set-RunSQLScript.sql'
TestFilePath = 'C:\DSCTemp\SQLScripts\Test-RunSQLScript.sql'
GetFilePath = 'C:\DSCTemp\SQLScripts\Get-RunSQLScript.sql'
}
Get-RunSQLScript.sql
select name from sys.databases where name = 'MyScriptDatabase1'
Set-RunSQLScript.sql
CREATE DATABASE [MyScriptDatabase1]
Test-RunSQLScript.sql
if (select count(name) from sys.databases where name = 'MyScriptDatabase1') = 0
BEGIN
RAISERROR ('Did not find database [MyScriptDatabase1]', 16, 1)
END
ELSE
BEGIN
PRINT 'Found database [MyScriptDatabase1]'
END
Version of the Operating System, SQL Server and PowerShell the DSC Target Node is running:
Windows Server 2012 R2, SQL Server 2014, PowerShell 4.0
Version of the DSC module you're using, or 'dev' if you're using current dev branch:
Dev