When I execute attempt to execute the script provided below, I get nothing back, no errors, nothing. And no changes are executed. I could use some help with this. Here is the script:
Function Insert-DefaultAddressesToKretaDb{
Param(
[parameter(Mandatory=$true)]
[string]$server,
[parameter(Mandatory=$true)]
[string]$database)
Write-Host "Executing on " $server " database " $database
$Connection = New-Object System.Data.SQLClient.SQLConnection
$Connection.ConnectionString = "server='$server';database='$database';trusted_connection=true;"
$Connection.Open()
$Command = New-Object System.Data.SQLClient.SQLCommand
$Command.Connection = $Connection
$Sql = "<validated and working sql script>"
$Command.CommandText = $Sql
$Command.ExecuteNonQuery()
$Connection.Close()
}
And this is how i tried to execute:
. .\Insert-DefaultAddressesToKkopDb.ps1 -server "<serverName>'-database "<databaseName>"
Any thoughts?