Integrated Authentication with Get-SqlInstance using PowerShell RRS feed

  • Question

  • Using PowerShell, how to use Windows Integrated Authentication to query all instances running on local host (or a specific server)?

    Can we use "Get-SqlInstance" (https://docs.microsoft.com/en-us/powershell/module/sqlserver/get-sqlinstance)


    • Edited by Eddie_Kumar Friday, January 5, 2018 11:02 AM
    • Moved by Bill_Stewart Wednesday, February 14, 2018 7:32 PM This is not SQL Server support forum
    Friday, January 5, 2018 10:57 AM

All replies

  • Please read the documents very carefully to see the restrictions and requirements.  bbe sure your sql instances are rovisioned for this command and that you provide the correct credentials.


    Friday, January 5, 2018 11:07 AM
  • Thanks for your reply, however:

    I understand that the "-Credential" is one of the required Parameters, but, is there anyway to create PSCredential object without having to enter Username & Password - similar to SSMS (SQL Server Management Studio), which seamlessly uses the Windows integration authentication WITHOUT prompting to input username/password.  I guess the question is: "What PowerShell code can be used to create a PSCredential object that uses Windows Integrated Authentication in the local machine where user is logged in with full Admin access?"


    • Edited by Eddie_Kumar Friday, January 5, 2018 1:37 PM
    Friday, January 5, 2018 1:34 PM
  • No.  You must provide a credential object in some way.  There is not way to get a password from the system for a credential.  "Integrated" security does not use credentials. 


    Friday, January 5, 2018 2:51 PM