728x90

$sqlConnection = New-Object system.data.sqlclient.sqlconnection "server=서버명또는IP;database=DatabaseName;user=계정;비밀번호;trusted_connection=true"
$sqlConnection.Open()
$sqlCommand = $sqlConnection.CreateCommand()
$sqlCommand.CommandText = "Select ResourceId, UserAtHost cnt FROM Resource"
$sqlReader = $sqlCommand.ExecuteReader()
while($sqlReader.Read())
{
$sqlReader["ResourceId"]
$sqlReader["UserAtHost"]
}
$sqlConnection.Close()

728x90

+ Recent posts