Server.Logins Property

Represents a collection of Login objects. Each Login object represents a login defined on the instance of Microsoft SQL Server.

Namespace: Microsoft.SqlServer.Management.Smo
Assembly: Microsoft.SqlServer.Smo (in microsoft.sqlserver.smo.dll)

Syntax

'Declaration
Public ReadOnly Property Logins As LoginCollection
public LoginCollection Logins { get; }
public:
property LoginCollection^ Logins {
    LoginCollection^ get ();
}
/** @property */
public LoginCollection get_Logins ()
public function get Logins () : LoginCollection

Property Value

A LoginCollection object that represents all the logins defined on the instance of SQL Server.

Remarks

Updated text:

The Logins property points to the LoginCollection object. The collection can be used to enumerate all the logins for the instance of SQL Server. If you are using Windows Authentication only, the Logins property represents Windows-authenticated accounts. With Mixed Mode Authentication, this property also represents accounts that are created by using SQL Server Authentication.

This namespace, class, or member is supported only in version 2.0 of the Microsoft .NET Framework.

Example

'Connect to the local, default instance of SQL Server.
Dim srv As Server
srv = New Server
'Display the logins on the instance of SQL Server.
Dim lg As Login
For Each lg In srv.Logins
   Console.WriteLine(lg.Name)
Next

Thread Safety

Any public static (Shared in Microsoft Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Platforms

Development Platforms

For a list of the supported platforms, see Hardware and Software Requirements for Installing SQL Server 2005.

Target Platforms

For a list of the supported platforms, see Hardware and Software Requirements for Installing SQL Server 2005.

See Also

Reference

Server Class
Server Members
Microsoft.SqlServer.Management.Smo Namespace

Other Resources

How to: Enumerate Logins and Associated Users in Visual Basic .NET
Using Collections
Setting Properties
Managing Servers