Quantcast
Channel: Forum Getting started with SQL Server
Viewing all articles
Browse latest Browse all 7129

invoke-sqlcmd - Windows Authentication Failed

$
0
0

Hello

I am running following from one of my Machine and trying to access to SQL serve from another machine. I am getting error, please let me know whats wrong I am doing

invoke-sqlcmd : Login failed for user wingroup\user1

$serverName = "Server01"
$DB = "customer"
$credential = Get-Credential #
$userName = $credential.UserName.Replace("\","")
$pass = $credential.GetNetworkCredential().password

invoke-sqlcmd -query $Query -database $DB -serverinstance $serverName -username $userName -password $pass | ConvertTo-CSV -NoTypeInformation -Delimiter ";" | ForEach-Object {$_.Replace('"','')}|Out-file Microsoft.PowerShell.Core\FileSystem::$exportPath
Avian


Viewing all articles
Browse latest Browse all 7129

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>