1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| #Setup for SQL Server connection
#SQL Server Name
$SQLServer = "INFRAsql\MREMOTE"
#Database Name and id/pass for connection
$SQLDBName = "MREMOTE"
$uid ="mremote"
$pwd = "pwdmremote"
#Create the SQL Connection Object
$SQLConn = New-Object System.Data.SQLClient.SQLConnection
#Create the SQL Command Object, to work with the Database
$SQLCmd = New-Object System.Data.SQLClient.SQLCommand
#Set the connection string one the SQL Connection Object
$SQLConn.ConnectionString = "Server = $SQLServer; Database = $SQLDBName; User ID = $uid; Password = $pwd;"
#Open the connection
$SQLConn.Open()
$cmd = $SQLConn.CreateCommand()
$cmd.CommandText ="INSERT tblCons VALUES (N'891a3a9f-d880-410c-9451-3385fd8845d8', 7, N'96973b08-e2ca-49c0-93ba-f7afb6edc1c4', CAST(0x0000A97B00AA5B76 AS DateTime), N'test yc 13', N'Connection', 0, N'', N'mRemoteNG', N'Général', N'admin', N'', N'', N'test13', N'RDP', N'Default Settings', 3389)"
$cmd.ExecuteNonQuery()
$SQLconn.Close() |
Partager