I know how to do all this in VBScript, but I'm forcing myself to do everything in PowerShell now, cause I'll never learn it if I don't use it...
I'm simply trying to parse a list of servers (I have a DSN for each) and execute a stored procedure on them. Can someone point out what I've got wrong?
I keep getting "Exception setting "ConnectionString": "Keyword not supported: 'dsn'."" error on line 7.
$Servers = Get-Content C:\Scripts\servers.txt
ForEach($Server in $Servers)
$connstr = "DSN=$Server;"
$SqlConnection = New-Object System.Data.SqlClient.SqlConnection
$SQLConnection.ConnectionString = $connstr
$SqlCommandText = "exec stored_procedure"
$SqlCmd = New-Object System.Data.SqlClient.SqlCommand($SqlCommandText, $SQLConnection)