Delen via


Server Class

The Server object represents an instance of SQL Server.

Inheritance Hierarchy

System.Object
  Microsoft.SqlServer.Management.Smo.SmoObjectBase
    Microsoft.SqlServer.Management.Smo.SqlSmoObject
      Microsoft.SqlServer.Management.Smo.Server

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

Syntax

'Declaration
<EvaluationModeAttribute(AutomatedPolicyEvaluationMode.CheckOnSchedule)> _
<PhysicalFacetAttribute> _
<RootFacetAttribute(GetType(Server))> _
Public NotInheritable Class Server _
    Inherits SqlSmoObject _
    Implements ISfcSupportsDesignMode, IAlterable, IScriptable, IServerSettings,  _
    IServerInformation, IDmfFacet, IAlienRoot, ISfcDomainLite, ISfcHasConnection
'Usage
Dim instance As Server
[EvaluationModeAttribute(AutomatedPolicyEvaluationMode.CheckOnSchedule)]
[PhysicalFacetAttribute]
[RootFacetAttribute(typeof(Server))]
public sealed class Server : SqlSmoObject, 
    ISfcSupportsDesignMode, IAlterable, IScriptable, IServerSettings, IServerInformation, 
    IDmfFacet, IAlienRoot, ISfcDomainLite, ISfcHasConnection
[EvaluationModeAttribute(AutomatedPolicyEvaluationMode::CheckOnSchedule)]
[PhysicalFacetAttribute]
[RootFacetAttribute(typeof(Server))]
public ref class Server sealed : public SqlSmoObject, 
    ISfcSupportsDesignMode, IAlterable, IScriptable, IServerSettings, IServerInformation, 
    IDmfFacet, IAlienRoot, ISfcDomainLite, ISfcHasConnection
[<SealedAttribute>]
[<EvaluationModeAttribute(AutomatedPolicyEvaluationMode.CheckOnSchedule)>]
[<PhysicalFacetAttribute>]
[<RootFacetAttribute(typeof(Server))>]
type Server =  
    class
        inherit SqlSmoObject
        interface ISfcSupportsDesignMode
        interface IAlterable
        interface IScriptable
        interface IServerSettings
        interface IServerInformation
        interface IDmfFacet
        interface IAlienRoot
        interface ISfcDomainLite
        interface ISfcHasConnection
    end
public final class Server extends SqlSmoObject implements ISfcSupportsDesignMode, IAlterable, IScriptable, IServerSettings, IServerInformation, IDmfFacet, IAlienRoot, ISfcDomainLite, ISfcHasConnection

The Server type exposes the following members.

Constructors

  Name Description
Public method Server() Initializes a new instance of the Server class.
Public method Server(String) Initializes a new instance of the Server class with the specified name.
Public method Server(ServerConnection) Initializes a new instance of the Server class based on the specified connection.

Top

Properties

  Name Description
Public property ActiveDirectory Gets information about the Active Directory settings for the instance of SQL Server.
Public property AffinityInfo Gets the AffinityInfo object that is associated with an instance of SQL Server.
Public property AuditLevel Gets or sets the AuditLevel property value.
Public property Audits Represents a collection of Audit objects. Each Audit object represents an audit log defined on the instance of SQL Server.
Public property BackupDevices Represents a collection of BackupDevice objects. Each BackupDevice object represents a backup device defined on the instance of SQL Server.
Public property BackupDirectory Gets or sets the BackupDirectory property value.
Public property BrowserServiceAccount Gets the service account that the Browser service runs under on the instance of SQL Server.
Public property BrowserStartMode Gets the start mode for the SQL Server Browser Service running on the instance of SQL Server.
Public property BuildClrVersion Gets the BuildClrVersion property value.
Public property BuildClrVersionString Gets the BuildClrVersionString property value.
Public property BuildNumber Gets the BuildNumber property value.
Public property Collation Gets the Collation property value.
Public property CollationID Gets the CollationID property value.
Public property ComparisonStyle Gets the ComparisonStyle property value.
Public property ComputerNamePhysicalNetBIOS Gets the ComputerNamePhysicalNetBIOS property value.
Public property Configuration Gets the configuration options for the instance of SQL Server.
Public property ConnectionContext Gets the current server connection details for the instance of SQL Server.
Public property Credentials Represents a collection of Credential objects. Each Credential object represents a credential defined on the instance of SQL Server.
Public property CryptographicProviders Gets the CryptographicProviders property value.
Public property Databases Represents a collection of Database objects. Each Database object represents a database defined on the instance of SQL Server.
Public property DefaultFile Gets or sets the DefaultFile property value.
Public property DefaultLog Gets or sets the DefaultLog property value.
Public property DefaultTextMode Gets or sets the Boolean property value that specifies whether the default text mode is set for the instance of SQL Server.
Public property Edition Gets the Edition property value.
Public property Endpoints Represents a collection of Endpoint objects. Each Endpoint object represents an endpoint defined on the instance of SQL Server.
Public property EngineEdition Gets the EngineEdition property value.
Public property ErrorLogPath Gets the ErrorLogPath property value.
Public property Events Gets the server events that are associated with the instance of SQL Server.
Protected property ExecuteForScalar Gets or sets the Boolean property value that specifies whether the object is set to the execute for scalar option. (Inherited from SqlSmoObject.)
Public property FilestreamLevel Gets the level of FILESTREAM access specified on the instance of SQL Server.
Public property FilestreamShareName Gets the Windows share name where FILESTREAM data is stored on the instance of SQL Server.
Public property FullTextService Gets the Microsoft Search Full-Text service implementation for the instance of SQL Server.
Public property Information Gets information about the instance of SQL Server.
Public property InstallDataDirectory Gets the local Windows directory where the installation data is stored for the instance of SQL Server.
Public property InstallSharedDirectory Gets the remote shared directory where the installation data is stored for the instance of SQL Server.
Public property InstanceName Gets the instance name of the instance of SQL Server. 
Public property IsCaseSensitive Gets the IsCaseSensitive property value.
Public property IsClustered Gets the IsClustered property value.
Public property IsFullTextInstalled Gets the Boolean value that specifies whether Full-Text service is installed on the instance of SQL Server.
Public property IsSingleUser Gets the IsSingleUser property value.
Protected property IsTouched Gets the Boolean property value that specifies whether the object properties have been updated but not yet persisted on the server. (Inherited from SqlSmoObject.)
Public property JobServer Gets the SQL Server Agent associated with the instance of SQL Server.
Public property Language Gets the Language property value.
Public property Languages Represents a collection of Language objects. Each Language object represents an languages supported by the instance of SQL Server.
Public property LinkedServers Represents a collection of LinkedServer objects. Each LinkedServer object represents a linked server registered on the instance of SQL Server.
Public property LoginMode Gets or sets the ServerLoginMode property value.
Public property Logins Represents a collection of Login objects. Each Login object represents a login defined on the instance of SQL Server.
Public property Mail Gets the Microsoft SQL Mail service associated with the instance of SQL Server.
Public property MailProfile Gets or sets the MailProfile property value.
Public property MasterDBLogPath Get the MasterDBLogPath property value.
Public property MasterDBPath Gets the MasterDBPath property value.
Public property MaxPrecision Gets the MaxPrecision property value.
Public property Name Gets the name of the server, which is the physical machine name.
Public property NamedPipesEnabled Gets the Boolean value that specifies whether Named Pipes provider is enabled for client-server connectivity on the instance of SQL Server.
Public property NetName Gets the NetName property value.
Public property NumberOfLogFiles Gets or sets the NumberOfLogFiles property value.
Protected property ObjectInSpace Gets the Boolean property value that specifies whether the object exists in isolation, or whether it is directly or indirectly connected to the instance of SQL Server. (Inherited from SqlSmoObject.)
Public property OleDbProviderSettings Gets the DbProviderSettings property value.
Public property OSVersion Gets the OSVersion property value.
Public property PerfMonMode Gets or sets the PerfMonMode property value.
Public property PhysicalMemory Gets the PhysicalMemory property value.
Public property PhysicalMemoryUsageInKB Gets an Int64 value that specifies the amount of memory in use by the instance of the Database Engine, in kilobytes.
Public property Platform Gets the Platform property value.
Public property Processors Gets the Processors property value.
Public property ProcessorUsage Gets an Int32 value that specifies the processor time used by the instance of the Database Engine.
Public property Product Gets the Product property value.
Public property ProductLevel Gets the ProductLevel property value.
Public property Properties Gets a collection of Property objects that represent the object properties. (Inherited from SqlSmoObject.)
Public property ProxyAccount Gets the proxy account associated with the instance of SQL Server.
Public property ResourceGovernor Gets the ResourceGovernor property value.
Public property ResourceLastUpdateDateTime Gets the ResourceLastUpdateDateTime property value.
Public property ResourceVersion Gets the ResourceVersion property.
Public property ResourceVersionString Gets the ResouceVersionString property value.
Public property Roles Represents a collection of ServerRole objects. Each ServerRole object represents a role defined on the instance of SQL Server.
Public property RootDirectory Gets the RootDirectory property value.
Protected property ScalarResult Gets the scalar result for the referenced object. (Inherited from SqlSmoObject.)
Public property ServerAuditSpecifications Represents a collection of ServerAuditSpecification objects. Each ServerAuditSpecification object represents a specific audit specification defined on the instance of SQL Server.
Public property ServerType Gets the server type for the instance of SQL Server.
Public property ServiceAccount Gets the service account under which the instance of SQL Server is running.
Public property ServiceInstanceId Gets the ID value that uniquely identifies the service instance for this instance of SQL Server.
Public property ServiceMasterKey Gets the service master key associated with the instance of SQL Server.
Public property ServiceName Gets the service name for the server.
Public property ServiceStartMode Gets the start mode for the SQL Server service.
Public property Settings Gets modifiable settings for the instance of SQL Server.
Public property SqlCharSet Gets the SqlCharSet property value.
Public property SqlCharSetName Gets the SqlCharSetName property value.
Public property SqlDomainGroup Gets the domain group for the instance of SQL Server.
Public property SqlSortOrder Gets the SqlSortOrder property value.
Public property SqlSortOrderName Gets the SqlSortOrderName property value.
Public property State Gets the state of the referenced object. (Inherited from SmoObjectBase.)
Public property Status Gets the current status of the Server.
Public property SystemDataTypes Represents a collection of SystemDataType objects. Each SystemDataType object represents a system data type defined on the instance of SQL Server.
Public property SystemMessages Represents a collection of SystemMessage objects. Each SystemMessage object represents a system message defined on the instance of SQL Server.
Public property TapeLoadWaitTime Gets or sets the TapeLoadWaitTime property value.
Public property TcpEnabled Gets the Boolean value that determines whether TCP/IP protocol is enabled on this instance of SQL Server.
Public property Triggers Represents a collection of ServerDdlTrigger objects. Each ServerDdlTrigger object represents a server data definition language (DDL) trigger that is defined on the instance of SQL Server.
Public property Urn Gets the Uniform Resource Name (URN) address value that uniquely identifies the object. (Inherited from SqlSmoObject.)
Public property UserData Gets or sets user-defined data associated with the referenced object. (Inherited from SmoObjectBase.)
Public property UserDefinedMessages Represents a collection of UserDefinedMessage objects. Each UserDefinedMessage object represents a user-defined message defined on the instance of SQL Server.
Public property UserOptions Gets the user options for the current connection to the instance of SQL Server.
Public property Version Gets the Version property value.
Public property VersionMajor Gets the VersionMajor property value.
Public property VersionMinor Gets the VersionMinor property value.
Public property VersionString Gets the VersionString property value.

Top

Methods

  Name Description
Protected method AddDatabaseContext(StringCollection) Add the database context to the collection of queries identified by the queries parameter. (Inherited from SqlSmoObject.)
Protected method AddDatabaseContext(StringCollection, ScriptingOptions) Add the database context to the collection of queries identified by the queries parameter, and using the specified scripting options. (Inherited from SqlSmoObject.)
Public method Alter() Updates any Server object property changes on the instance of SQL Server. 
Public method Alter(Boolean) Updates any Server object property changes on the instance of SQL Server with the option to override value checking.
Protected method AlterImpl Activates the object altered event. (Inherited from SqlSmoObject.)
Protected method AlterImplFinish Method called when object altered event finishes. (Inherited from SqlSmoObject.)
Protected method AlterImplInit Method called when object-altered event is intialized. (Inherited from SqlSmoObject.)
Protected method AlterImplWorker Calls the Alter methods. (Inherited from SqlSmoObject.)
Public method AttachDatabase(String, StringCollection) Attaches an existing database that is made up of one or more files to the instance of SQL Server with the specified name and using the specified data files. 
Public method AttachDatabase(String, StringCollection, AttachOptions) Attaches an existing database that is made up of one or more files to the instance of SQL Server that has the specified name and using the specified data files and attachment options. 
Public method AttachDatabase(String, StringCollection, String) Attaches an existing database that is made up of one or more files to the instance of SQL Server with the specified name and using the specified data files. 
Public method AttachDatabase(String, StringCollection, String, AttachOptions) Attaches an existing database that is made up of one or more files to the instance of SQL Server by using the specified name, data files, and attachment options. 
Protected method BindDefaultImpl Binds the default items identified by the parameters. (Inherited from SqlSmoObject.)
Protected method BindRuleImpl Binds the rule schema to the rule and columns identified by the parameters. (Inherited from SqlSmoObject.)
Protected method CheckCollation Checks the order of the scripting options by the collation method identified by the collationName parameter. (Inherited from SqlSmoObject.)
Protected method CheckObjectState() Validates the state of the referenced object. (Inherited from SqlSmoObject.)
Protected method CheckObjectState(Boolean) Validates the state of the referenced object with the option to specify that an exception is thrown if the object is not yet created. (Inherited from SqlSmoObject.)
Protected method CheckObjectStateImpl Checks the state of a SqlSmoObject. (Inherited from SqlSmoObject.)
Protected method CheckVersion100 Checks whether version of SQL Server is SQL Server 2008. (Inherited from SqlSmoObject.)
Protected method CheckVersion80 Checks the validity of the object on SQL Server 2000. (Inherited from SqlSmoObject.)
Protected method CheckVersion80SP3 Checks the validity of the object on SQL Server 2000 SP3. (Inherited from SqlSmoObject.)
Protected method CheckVersion90 Check the validity of the object on SQL Server 2005. (Inherited from SqlSmoObject.)
Protected method CheckVersionBelow90 Checks whether version of SQL Server is before SQL Server 2005. (Inherited from SqlSmoObject.)
Protected method CleanObject Sets the object to unmodified state. (Inherited from SqlSmoObject.)
Public method CompareUrn Compares two URNS.
Protected method CreateImpl Creates an object with scripting options. (Inherited from SqlSmoObject.)
Protected method CreateImplFinish Method called when the create event finishes. (Inherited from SqlSmoObject.)
Protected method CreateImplInit Method called when the create event initializes. (Inherited from SqlSmoObject.)
Public method DeleteBackupHistory(DateTime) Deletes the backup history for this instance of SQL Server up until the specified date and time.
Public method DeleteBackupHistory(Int32) Deletes the backup history for the specified media set.
Public method DeleteBackupHistory(String) Deletes the backup history for the specified database.
Public method Deny(ServerPermissionSet, String) Denies the specified set of permissions for the specified grantee on the instance of SQL Server.
Public method Deny(ServerPermissionSet, array<String[]) Denies the specified set of permissions for the specified grantees on the instance of SQL Server.
Public method Deny(ServerPermissionSet, String, Boolean) Denies the specified set of permissions for the specified grantee and other users that the grantee granted the specified set of permissions on the instance of SQL Server.
Public method Deny(ServerPermissionSet, array<String[], Boolean) Denies the specified set of permissions for the specified grantees and other users that the grantee granted the specified set of permissions on the instance of SQL Server.
Public method DetachDatabase(String, Boolean) Detaches the specified database from the instance of SQL Server with the option to update statistics before the database is detached.
Public method DetachDatabase(String, Boolean, Boolean) Detaches the specified database from the instance of SQL Server with the option to update statistics before the database is detached.
Public method DetachedDatabaseInfo Returns information about a detached database file.
Public method Discover Discovers a list of type Object. (Inherited from SqlSmoObject.)
Protected method DropImpl Drops a SqlSmoObject. (Inherited from SqlSmoObject.)
Protected method DropImplWorker Calls the drop methods. (Inherited from SqlSmoObject.)
Public method EnumActiveCurrentSessionTraceFlags Gets active session flags as a DataTable.
Public method EnumActiveGlobalTraceFlags Gets a DataTable that contains active global trace flags.
Public method EnumAvailableMedia() Enumerates a list of media that is visible to the instance of SQL Server on the local area network.
Public method EnumAvailableMedia(MediaTypes) Enumerates a list of media that is visible to the instance of SQL Server on the local area network and limited to the type of media specified.
Public method EnumCollations Enumerates a list of collations supported by the instance of SQL Server.
Public method EnumDatabaseMirrorWitnessRoles() Enumerates a list of database mirror witness roles.
Public method EnumDatabaseMirrorWitnessRoles(String) Enumerates a list of mirror witness roles for the specified database.
Public method EnumDetachedDatabaseFiles Enumerates a list of detached database files.
Public method EnumDetachedLogFiles Enumerates a list of detached log files.
Public method EnumDirectories Enumerates a list of directories relative to the specified path.
Public method EnumErrorLogs Enumerates a list of SQL Server error log files.
Public method EnumLocks() Enumerates a list of current locks held on the instance of SQL Server.
Public method EnumLocks(Int32) Enumerates a list of current locks held by the specified process on the instance of SQL Server.
Public method EnumMembers Enumerates a list of members of server roles and database roles on the instance of SQL Server.
Public method EnumObjectPermissions() Enumerates a list of object permissions for the instance of SQL Server.
Public method EnumObjectPermissions(String) Enumerates a list of object permissions for a specified grantee on the application instance of SQL Server.
Public method EnumObjectPermissions(ObjectPermissionSet) Enumerates a list of object permissions for a specified permission on the instance of SQL Server.
Public method EnumObjectPermissions(String, ObjectPermissionSet) Enumerates a list of object permissions for a specified grantee and a specified permission on the instance of SQL Server.
Public method EnumPerformanceCounters() Enumerates a list of performance counters that are supported by the instance of SQL Server.
Public method EnumPerformanceCounters(String) Enumerates a list of performance counters that are supported by the instance of SQL Server for a specified object.
Public method EnumPerformanceCounters(String, String) Enumerates a list of performance counters that are supported by the instance of SQL Server for a specified object and specified counter.
Public method EnumPerformanceCounters(String, String, String) Enumerates a list of performance counters that are supported by the instance of SQL Server for a specified object, for a specified counter, and on the specified instance of SQL Server.
Public method EnumProcesses() Enumerates a list of processes running on the instance of SQL Server.
Public method EnumProcesses(Boolean) Enumerates a list of processes running on the instance of SQL Server with the option to exclude system processes.
Public method EnumProcesses(Int32) Enumerates a list of information about the specified process.
Public method EnumProcesses(String) Enumerates a list of processes running on the instance of SQL Server that are associated with the specified login.
Protected method EnumScriptImpl Enumerates scripts specified by the so parameter. (Inherited from SqlSmoObject.)
Protected method EnumScriptImplWorker Calls the methods that enumerate scripts specified by the so parameter. (Inherited from SqlSmoObject.)
Protected method EnumScriptImplWorkerSOChanged Returns an IEnumerable string describing the scripting options for an object. (Inherited from SqlSmoObject.)
Public method EnumServerAttributes Enumerates a list of server attributes for the instance of SQL Server.
Public method EnumServerPermissions() Enumerates a list of server permissions for the instance of SQL Server.
Public method EnumServerPermissions(String) Enumerates a list of server permissions for a specified grantee on the instance of SQL Server.
Public method EnumServerPermissions(ServerPermissionSet) Enumerates a list of server permissions for a specified permission on the instance of SQL Server.
Public method EnumServerPermissions(String, ServerPermissionSet) Enumerates a list of server permissions for a specified grantee and a specified permission on the instance of SQL Server.
Public method EnumStartupProcedures Enumerates a list of startup procedures.
Public method EnumWindowsDomainGroups() Enumerates a list of Microsoft Windows group accounts defined on a domain.
Public method EnumWindowsDomainGroups(String) Enumerates a list of Microsoft Windows group accounts defined for the specified domain.
Public method EnumWindowsGroupInfo() Enumerates a list of information about all Microsoft Windows groups that have explicitly granted access to the instance of SQL Server.
Public method EnumWindowsGroupInfo(String) Enumerates a list of information about all Microsoft Windows groups that have explicitly granted access to the instance of SQL Server.
Public method EnumWindowsGroupInfo(String, Boolean) Enumerates a list of information about all Microsoft Windows groups that have explicitly granted access to the instance of SQL Server and with the option to list the individual members.
Public method EnumWindowsUserInfo() Enumerates a list of information about all Microsoft Windows users that have explicitly granted access to SQL Server.
Public method EnumWindowsUserInfo(String) Enumerates a list of information about all Microsoft Windows users that have explicitly granted access to the instance of SQL Server.
Public method EnumWindowsUserInfo(String, Boolean) Enumerates a list of information about all Microsoft Windows users that have explicitly granted access to the instance of SQL Server and with the option to list all the permissions paths (groups) through which the user has been granted access to the instance of SQL Server.
Public method Equals (Inherited from Object.)
Protected method ExecuteNonQuery Executes a batch in the context of the database where there are no results returned. (Inherited from SqlSmoObject.)
Protected method Finalize (Inherited from Object.)
Protected method FormatSqlVariant Formats an object as SqlVariant type. (Inherited from SqlSmoObject.)
Protected method GenerateDataSpaceFileStreamScript Generates a script to create data file. (Inherited from SqlSmoObject.)
Protected method GenerateDataSpaceScript Generates a script to allocate space in the data file. (Inherited from SqlSmoObject.)
Public method GetActiveDBConnectionCount Returns the number of active connections for the specified database.
Protected method GetBindDefaultScript Gets the script that binds defaults specified by the defSchema and defName parameters. (Inherited from SqlSmoObject.)
Protected method GetBindRuleScript Gets the script that specifies the binding rules. (Inherited from SqlSmoObject.)
Protected method GetBoolParameter(StringBuilder, ScriptingOptions, String, String, Int32%) Assigns a Boolean parameter of the SqlSmoObject. (Inherited from SqlSmoObject.)
Protected method GetBoolParameter(StringBuilder, ScriptingOptions, String, String, Int32%, Boolean) Assigns a Boolean property of the SqlSmoObject. (Inherited from SqlSmoObject.)
Protected method GetDateTimeParameter Assigns the datetime property of the SqlSmoObject. (Inherited from SqlSmoObject.)
Protected method GetDateTimeParameterAsInt Assigns the datetime property of the SqlSmoObject as an integer value if the datetime property is not null. (Inherited from SqlSmoObject.)
Protected method GetDBName Gets the database name that is associated with the object. (Inherited from SqlSmoObject.)
Public method GetDefaultInitFields Returns the property types that are initialized by default when the specified object is initialized.
Protected method GetEnumParameter Assigns an enumeration property of the SqlSmoObject. (Inherited from SqlSmoObject.)
Protected method GetFragOptionString Gets a FragmentationOption object as a string value. (Inherited from SqlSmoObject.)
Protected method GetGuidParameter Assigns a Guid property of the SqlSmoObject. (Inherited from SqlSmoObject.)
Public method GetHashCode (Inherited from Object.)
Protected method GetParameter(StringBuilder, ScriptingOptions, String, String, Int32%) Assigns a parameter of the SqlSmoObject. (Inherited from SqlSmoObject.)
Protected method GetParameter(StringBuilder, ScriptingOptions, String, String, Int32%, Boolean) Assigns a parameter of the SqlSmoObject. (Inherited from SqlSmoObject.)
Public method GetPropertyNames Returns the names of the initialized properties for the specified object type
Protected method GetPropValue Gets a property value of the SqlSmoObject object. (Inherited from SqlSmoObject.)
Protected method GetPropValueOptional Gets a property value of the SqlSmoObject object. (Inherited from SqlSmoObject.)
Protected method GetPropValueOptionalAllowNull Gets a property value of the SqlSmoObject object. (Inherited from SqlSmoObject.)
Protected method GetRealValue Gets a property value of the SqlSmoObject object. (Inherited from SqlSmoObject.)
Protected method GetScriptingOptionsForCreate Gets ScriptingOptions for the SqlSmoObject object. (Inherited from SqlSmoObject.)
Protected method GetServerName Gets the name of the instance of SQL Server with which the object is associated. (Inherited from SqlSmoObject.)
Protected method GetServerObject Gets the server of the SqlSmoObject object. (Inherited from SqlSmoObject.)
Public method GetSmoObject Gets a SqlSmoObject that is specified by a URN.
Protected method GetSqlServerVersionName Gets the version name of the instance of SQL Server with which the object is associated. (Inherited from SqlSmoObject.)
Public method GetStringComparer Gets an IComparer interface.
Protected method GetStringParameter(StringBuilder, ScriptingOptions, String, String, Int32%) Assigns a string parameter of the SqlSmoObject object. (Inherited from SqlSmoObject.)
Protected method GetStringParameter(StringBuilder, ScriptingOptions, String, String, Int32%, Boolean) Assigns a string parameter of the SqlSmoObject object. (Inherited from SqlSmoObject.)
Protected method GetTimeSpanParameterAsInt Assigns a time span parameter of the SqlSmoObject object. (Inherited from SqlSmoObject.)
Public method GetType (Inherited from Object.)
Protected method GetUrnRecursive(StringBuilder) Assigns an Urn object of the SqlSmoObject object. (Inherited from SqlSmoObject.)
Protected method GetUrnRecursive(StringBuilder, UrnIdOption) Assigns an Urn object of the SqlSmoObject object. (Inherited from SqlSmoObject.)
Public method Grant(ServerPermissionSet, String) Grants the specified set of permissions to the specified grantee on the instance of SQL Server.
Public method Grant(ServerPermissionSet, array<String[]) Grants the specified set of permissions to the specified grantees on the instance of SQL Server.
Public method Grant(ServerPermissionSet, String, Boolean) Grants access to the specified permission to the grantee and the ability to grant access to other users on the instance of SQL Server.
Public method Grant(ServerPermissionSet, array<String[], Boolean) Grants access to the specified permission to the grantees and the ability to grant access to other users on the instance of SQL Server.
Public method Grant(ServerPermissionSet, String, Boolean, String) Grants the specified set of permissions to the grantee and the ability to grant the set of permissions to other users on the instance of SQL Server under an assumed role.
Public method Grant(ServerPermissionSet, array<String[], Boolean, String) Grants the specified set of permissions to the grantees and the ability to grant the set of permissions to other users on the instance of SQL Server under an assumed role.
Protected method ImplInitialize Initializes the fields of the SqlSmoObject object. (Inherited from SqlSmoObject.)
Public method Initialize() Initializes the object and forces the properties be loaded. (Inherited from SqlSmoObject.)
Public method Initialize(Boolean) Initializes the object and forces the properties be loaded. (Inherited from SqlSmoObject.)
Public method IsDetachedPrimaryFile Verifies whether the specified file is a primary (.mdf) database file.
Protected method IsObjectDirty Verifies whether the object properties have been modified and the changes have not yet been persisted on the instance of SQL Server. (Inherited from SqlSmoObject.)
Protected method IsObjectInitialized Verifies whether the object has been initialized. (Inherited from SqlSmoObject.)
Protected method IsObjectInSpace Verifies whether the object is isolated or connected to the instance of SQL Server. (Inherited from SqlSmoObject.)
Protected method IsVersion80SP3 Determines whether the version of SQL Server is SQL Server 2000 with SP3. (Inherited from SqlSmoObject.)
Protected method IsVersion90AndAbove Determines whether the version of SQL Server is SQL Server 2005 or later. (Inherited from SqlSmoObject.)
Public method IsWindowsGroupMember Verifies whether the specified Microsoft Windows user account is a member of the specified Windows group.
Public method KillAllProcesses Stops the all processes on the specified database.
Public method KillDatabase Deletes the specified database and drops any active connection.
Public method KillProcess Stops the specified process.
Protected method MarkDropped Sets the SqlSmoState to dropped. (Inherited from SqlSmoObject.)
Protected method MarkForDropImpl Sets the SqlSmoState to dropped. (Inherited from SqlSmoObject.)
Protected method MemberwiseClone (Inherited from Object.)
Public method PingSqlServerVersion(String) Gets the version number of the instance of SQL Server.
Public method PingSqlServerVersion(String, String, String) Get the version number of the specified instance of SQL Server using the specified login and password to gain access.
Protected method PostAlter Method activated after the SqlSmoObject is altered. (Inherited from SqlSmoObject.)
Protected method PostCreate Method activated after the SqlSmoObject is created. (Inherited from SqlSmoObject.)
Protected method PostDrop Method activated after the SqlSmoObject is dropped. (Inherited from SqlSmoObject.)
Public method ReadErrorLog() Enumerates the SQL Server error log.
Public method ReadErrorLog(Int32) Enumerates the specified SQL Server error log.
Public method Refresh Refreshes the objects and properties on the Server object. (Overrides SqlSmoObject.Refresh().)
Public method Revoke(ServerPermissionSet, String) Revokes a previously granted set of permissions from a list of grantees on the instance of SQL Server.
Public method Revoke(ServerPermissionSet, array<String[]) Revokes a previously granted set of permissions from a list of grantees on the instance of SQL Server.
Public method Revoke(ServerPermissionSet, String, Boolean, Boolean) Revokes previously granted permissions from a grantee on the instance of SQL Server and any other users to whom the grantee has granted the specified set of permissions. The grantee is also given the ability to revoke the specified set of permissions from other users under an assumed role.
Public method Revoke(ServerPermissionSet, array<String[], Boolean, Boolean) Revokes previously granted permissions from grantees on the instance of SQL Server and any other users to whom the grantees have granted the specified set of permissions. The grantees are also given the ability to revoke the specified set of permissions from other users under an assumed role.
Public method Revoke(ServerPermissionSet, String, Boolean, Boolean, String) Revokes previously granted permissions from a grantee on the instance of SQL Server and any other users to whom the grantee has granted the specified set of permissions. The grantee is also given the ability to revoke the specified set of permissions from other users under an assumed role.
Public method Revoke(ServerPermissionSet, array<String[], Boolean, Boolean, String) Revokes previously granted permissions from grantees on the instance of SQL Server and any other users to whom the grantees have granted the specified set of permissions. The grantees are also given the ability to revoke the specified set of permissions from other users under an assumed role.
Public method Script() Generates a Transact-SQL script that can be used to re-create the server.
Public method Script(ScriptingOptions) Generates a Transact-SQL script that can be used to re-create the server by using the specified scripting options.
Protected method ScriptAlter Alters the SqlSmoObject according to the parameters. (Inherited from SqlSmoObject.)
Protected method ScriptCreate Alters the SqlSmoObject according to the parameters. (Inherited from SqlSmoObject.)
Protected method ScriptDdl Throws InvalidSmoOperationException. (Inherited from SqlSmoObject.)
Protected method ScriptDrop Throws InvalidSmoOperationException. (Inherited from SqlSmoObject.)
Protected method ScriptImpl() Gets a collection of scripts of the SqlSmoObject. (Inherited from SqlSmoObject.)
Protected method ScriptImpl(ScriptingOptions) Gets a collection of scripts of the SqlSmoObject. (Inherited from SqlSmoObject.)
Protected method ScriptImplWorker Gets a collection of scripts of the SqlSmoObject. (Inherited from SqlSmoObject.)
Public method SetDefaultInitFields(Boolean) Specifies that all properties are fetched when objects are instantiated.
Public method SetDefaultInitFields(Type, Boolean) Specifies all the properties are fetched when objects of the specified type are instantiated.
Public method SetDefaultInitFields(Type, StringCollection) Specifies the properties that are fetched when objects of the specified type are instantiated.
Public method SetDefaultInitFields(Type, array<String[]) Specifies the properties that are fetched when objects of the specified type are instantiated.
Protected method SetParentImpl Sets the parent of the SqlSmoObject to the newParent parameter. (Inherited from SqlSmoObject.)
Public method SetTraceFlag Sets a trace flag.
Public method ToString Returns a String that represents the referenced object. (Inherited from SqlSmoObject.)
Protected method TouchImpl Not implemented. (Inherited from SqlSmoObject.)
Protected method UnbindDefaultImpl Unbinds the default columns of the SqlSmoObject. (Inherited from SqlSmoObject.)
Protected method UnbindRuleImpl Unbinds rules of the SqlSmoObject. (Inherited from SqlSmoObject.)
Public method Validate Validates the state of an object. (Inherited from SmoObjectBase.)

Top

Events

  Name Description
Public event PropertyChanged Represents the event that occurs when a property is changed. (Inherited from SqlSmoObject.)
Public event PropertyMetadataChanged Represents the event that occurs when property metadata changes. (Inherited from SqlSmoObject.)

Top

Fields

  Name Description
Protected field m_ExtendedProperties Represents a property that is defined to extend the properties provided by a SqlSmoObject. (Inherited from SqlSmoObject.)
Protected field singletonParent Represents the singleton parent. (Inherited from SqlSmoObject.)

Top

Explicit Interface Implementations

  Name Description
Explicit interface implemetationPrivate method IAlienObject.Discover Discovers any dependencies. Do not reference this member directly in your code. It supports the SQL Server infrastructure. (Inherited from SqlSmoObject.)
Explicit interface implemetationPrivate method IAlienObject.GetDomainRoot Returns the root of the domain. (Inherited from SqlSmoObject.)
Explicit interface implemetationPrivate method IAlienObject.GetParent Gets the parent of this object. Do not reference this member directly in your code. It supports the SQL Server infrastructure. (Inherited from SqlSmoObject.)
Explicit interface implemetationPrivate method IAlienObject.GetPropertyType Gets the type of the specified property. (Inherited from SqlSmoObject.)
Explicit interface implemetationPrivate method IAlienObject.GetPropertyValue Gets the value of the specified property. (Inherited from SqlSmoObject.)
Explicit interface implemetationPrivate method IAlienObject.GetUrn Gets the Unified Resource Name of the object. Do not reference this member directly in your code. It supports the SQL Server infrastructure. (Inherited from SqlSmoObject.)
Explicit interface implemetationPrivate method IAlienObject.Resolve Gets the instance that contains the information about the object from the Unified Resource Name of the object. (Inherited from SqlSmoObject.)
Explicit interface implemetationPrivate method IAlienObject.SetObjectState Sets the object state to the specified SfcObjectState value. (Inherited from SqlSmoObject.)
Explicit interface implemetationPrivate method IAlienObject.SetPropertyValue Sets the property value. (Inherited from SqlSmoObject.)
Explicit interface implemetationPrivate method IAlienRoot.DesignModeInitialize Identified for informational purposes only. Not supported. Future compatibility is not guaranteed. Ensures that the Server object is in design mode, that it is disconnected from the instance of the Database Engine it represents.
Explicit interface implemetationPrivate method IAlienRoot.SfcHelper_GetDataTable Identified for informational purposes only. Not supported. Future compatibility is not guaranteed. Gets a DataTable object containing the results from a URN.
Explicit interface implemetationPrivate method IAlienRoot.SfcHelper_GetSmoObject Identified for informational purposes only. Not supported. Future compatibility is not guaranteed. Gets the Object that represents the object identified by a specified URN.
Explicit interface implemetationPrivate method IAlienRoot.SfcHelper_GetSmoObjectQuery Identified for informational purposes only. Not supported. Future compatibility is not guaranteed. Gets a List of String values.
Explicit interface implemetationPrivate property ISfcDomainLite.DomainInstanceName Gets the instance name of the domain.
Explicit interface implemetationPrivate property ISfcDomainLite.DomainName Gets the domain name.
Explicit interface implemetationPrivate method ISfcDomainLite.GetLogicalVersion Identified for informational purposes only. Not supported. Future compatibility is not guaranteed. Gets an Int32 value that indicates whether changes have been made to the Server object.
Explicit interface implemetationPrivate property ISfcHasConnection.ConnectionContext Gets the context for the connection represented by the current Server object.
Explicit interface implemetationPrivate method ISfcHasConnection.GetConnection() Identified for informational purposes only. Not supported. Future compatibility is not guaranteed. Gets a connection to an Sfc backing store.
Explicit interface implemetationPrivate method ISfcHasConnection.GetConnection(SfcObjectQueryMode) Identified for informational purposes only. Not supported. Future compatibility is not guaranteed. Gets a connection to an Sfc backing store that supports the requested query mode.
Explicit interface implemetationPrivate method ISfcHasConnection.SetConnection Identified for informational purposes only. Not supported. Future compatibility is not guaranteed. Sets a connection to an Sfc backing store.
Explicit interface implemetationPrivate method ISfcPropertyProvider.GetPropertySet Gets the interface reference to the set of properties of this object. Do not reference this member directly in your code. It supports the SQL Server infrastructure. (Inherited from SqlSmoObject.)
Explicit interface implemetationPrivate property ISfcSupportsDesignMode.IsDesignMode Gets a Boolean value that specifies whether the Server supports design mode.

Top

Remarks

The Server class represents an instance of SQL Server. In SMO programming, the Server object determines the connection to a physical SQL Server installation. The Server class is the highest level in the SMO instance object hierarchy. When a Server object variable is created, it establishes a connection to an instance of SQL Server. If you do not specify the name in the Server class constructor, the connection is always made with the local, default instance of SQL Server.

By using the Server object, you can do the following:

  • Connect to an instance of SQL Server.

  • Modify the connection settings.

  • Run Transact-SQL statements directly.

  • Capture Transact-SQL output from the SMO program.

  • Manage transactions.

  • View operating system information.

  • Modify and view SQL Server settings, information, and user options.

  • Modify and view SQL Server configuration options.

  • Register the instance of SQL Server in the Active Directory directory service.

  • Subscribe to and handle SQL Server events.

  • Reference databases, endpoints, credentials, logins, linked servers, system messages, DDL triggers, system data types, and user-defined messages.

  • Regenerate the service master key.

  • Detach and attach databases.

  • Stop processes or databases.

  • Grant, deny, or revoke permissions on the database.

  • Enumerate information about the server.

  • Read the error log.

  • Remove the backup history.

  • Get and set the default initialization fields for specified types.

  • Create endpoints, such as database mirroring endpoint.

To get Server object properties, users can be a member of the public fixed server role.

To set Server object properties, users must be a member of the sysadmin fixed server role.

Thread Safety

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

Thread Safety

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