locked
Cannot login using Windows Authentication outside of SSMS RRS feed

  • Question

  •  Hi,

    I recently upgraded my windows to insider build 17713.rs5_release.180706-1551. After doing so am unable to connect to SQL-Server outside of SSMS with NT Security. For <g class="gr_ gr_28 gr-alert gr_gramm gr_inline_cards gr_run_anim Punctuation only-ins replaceWithoutSep" data-gr-id="28" id="28">example</g> running the following script fails:

    $Global:DatabaseName  = ".";
    $Global:ServerAddress = "TRISDEmo";
    
    $Query_TestConnection = "SELECT TOP 1 * FROM AM"
    
    if ((Invoke-Sqlcmd -Query $Query_TestConnection -ServerInstance $Global:ServerAddress -Database $Global:DatabaseName) -ne $null ) {
    	## Re-enable buttons and combo boxes
    	$btnEvaluate.Enabled   = $true;
    	$btnRun.Enabled        = $true;
    	$cbSource.Enabled      = $true;
    	$cbDestination.Enabled = $true;
    
    	## fill combo boxes
    	$Query_GetManagers = "SELECT AMName + ' (' + AMID + ')' FROM AM ORDER BY AMName"
    	$ManagerList = Invoke-Sqlcmd -Query $Query_GetManagers -ServerInstance $Global:ServerAddress -Database $Global:DatabaseName
    
    	foreach ($item in $ManagerList) {
    		$cbSource.Items.Add($item.ItemArray[0]);
    		$cbDestination.Items.Add($item.ItemArray[0]);
    	}
    }


    With the following error message:

    Invoke-Sqlcmd : A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not 
    accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 
    40 - Could not open a connection to SQL Server)

    This is also affecting my connection from an application called TRIS which connects to an SQL database. As stated if I try to connect to SSMS directly, I can, using my windows login, from another source I have to use an SQL login.

    Any help would be much appreciated!






    • Edited by OwainEsau Wednesday, August 1, 2018 2:03 AM
    Wednesday, August 1, 2018 1:41 AM

Answers

  • $Global:DatabaseName  = ".";
    $Global:ServerAddress = "TRISDEmo";
    You inverted database & server Name; server Name should be "." (dot) for a local Connection, not the database name

    Olaf Helper

    [ Blog] [ Xing] [ MVP]

    • Marked as answer by OwainEsau Wednesday, August 1, 2018 7:48 AM
    Wednesday, August 1, 2018 6:17 AM

All replies

  • Check sql port is telnet ?

    Check udl test using following link

    https://success.trendmicro.com/solution/1117712-creating-a-data-link-udl-file-and-testing-the-connectivity-to-a-microsoft-sql-server


    https://social.technet.microsoft.com/wiki/contents/articles/37872.sql-server-installation-on-centos-linux.aspx

    Wednesday, August 1, 2018 3:51 AM
  • $Global:DatabaseName  = ".";
    $Global:ServerAddress = "TRISDEmo";
    You inverted database & server Name; server Name should be "." (dot) for a local Connection, not the database name

    Olaf Helper

    [ Blog] [ Xing] [ MVP]

    • Marked as answer by OwainEsau Wednesday, August 1, 2018 7:48 AM
    Wednesday, August 1, 2018 6:17 AM
  • Can't believe I spent over an hour trying to figure this out..... thankyou 
    Wednesday, August 1, 2018 7:48 AM