I am not able to pass credential or says login failed(when it is correct)
$cred = $host.ui.PromptForCredential("Need credentials for the Server", "Please enter your user name and password.", "", "NetBiosUserName") Invoke-Sqlcmd -Credential $cred -Query (SELECT * from TESTDB" -ServerInstance "test4"
Request the expert help to get this corrected. it looks like the -credential doesnt work for invoke-sqlcmd. I see few answer as run as powershell with the required accounts, but I am combining many other script and want to work on credential popup…any help?