This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function selectPOSData ($Server, $Database, $SQLQuery, $Username, $Password) { | |
| $Connection = New-Object System.Data.SQLClient.SQLConnection | |
| $Connection.ConnectionString = "server='$Server';database='$Database';User ID= $Username; Password= $Password;" | |
| $Connection.Open() | |
| $Command = New-Object System.Data.SQLClient.SQLCommand | |
| $Command.Connection = $Connection | |
| $Command.CommandText = $SQLQuery | |
| $Reader = $Command.ExecuteReader() | |
| while ($Reader.Read()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $conn = New-Object System.Data.SqlClient.SqlConnection | |
| $conn.ConnectionString = $connectionString | |
| $cmd = New-Object System.Data.SqlClient.SqlCommand | |
| $cmd.commandtext = $query | |
| $conn.open() | |
| #Creates sql command | |
| if ($conn.Open()) | |
| { | |
| Write-Host "connection established..." | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $conn = New-Object System.Data.SqlClient.SqlConnection | |
| $conn.ConnectionString = $connectionString | |
| $cmd = New-Object System.Data.SqlClient.SqlCommand | |
| $cmd.commandtext = $query | |
| $conn.open() | |
| #Creates sql command | |
| if ($conn.Open()) | |
| { | |
| Write-Host "connection established..." | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $connectionString = "Data Source=SQLSERVER;Initial Catalog=SYSINFO;Integrated Security=SSPI;" | |
| #Find Connection information | |
| #Gets system information | |
| $os = Get-WmiInfo Win32_OperatingSystem | |
| #loads the part of the .NET Framework that’s responsible for working with databases | |
| [assembly.reflection]::loadwithpartialname('System.Data') | |
| #Create new connection to database | |
| $conn = New-Object System.Data.SqlClient.SqlConnection | |
| $conn.ConnectionString = $connectionString | |
| $conn.open() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $jsonObject = @{ | |
| "TERMINALID" = "3232" | |
| "PINSERV" = "192.168.1.52:5145" | |
| "MERCHANTID" = "01" | |
| "ID" = "1421336011" | |
| "Serv" = "192.168.1.180:5150" | |
| "Lane" = "2017" | |
| } | ConvertTo-Json | |
| $TestDir = 'URL/Filename.xml'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| MemberType : TypeInfo | |
| DeclaringType : | |
| DeclaringMethod : | |
| ReflectedType : | |
| StructLayoutAttribute : System.Runtime.InteropServices.StructLayoutAttribu | |
| te | |
| GUID : 5f6aa156-8585-35c9-a6ae-2aefd06aaa4a | |
| Module : System.Management.Automation.dll | |
| Assembly : System.Management.Automation, Version=3.0.0.0, | |
| Culture=neutral, PublicKeyToken=31bf3856ad364e35 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $jsonObject = @{ | |
| TERMID = 3232 | |
| PINSERV = '192.168.1.52:5145' | |
| MERCHANTID = 01 | |
| ID = 1421336011 | |
| Serv = '192.168.1.180:5150' | |
| Lane = 2017 | |
| } | ConvertTo-Json | |
| $TestDir = 'path/filename.xml'; |
NewerOlder