Listing authentication mode
In this recipe, we will list the currently enabled authentication mode in your SQL Server instance, using PowerShell and SMO.
Getting ready
Confirm which authentication mode your instance is running. Go to SQL Server Management Studio and log in to your instance. Once logged in, right-click on the instance and go to Properties | Security:
How to do it...
Let's list the steps required to list your instance's current authentication mode:
Open PowerShell ISE as an administrator.
Import the
SQLPS
module and create a new SMO Server Object as follows:#import SQL Server module Import-Module SQLPS -DisableNameChecking #replace this with your instance name $instanceName = "localhost" $server = New-Object -TypeName Microsoft.SqlServer.Management.Smo.Server -ArgumentList $instanceName
Add the following script and run:
#display login mode $server.settings.LoginMode
How it works...
This is a very short and straightforward recipe. To display the login mode, you need to have a handle...