SPService.AutoProvision property
Available in SharePoint 2016 and later. Gets (and in some scenarios sets) a Boolean value that indicates whether the service is enabled on the farm.
Namespace: Microsoft.SharePoint.Administration
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Syntax
'Declaration
Public Overridable Property AutoProvision As Boolean
Get
Set
'Usage
Dim instance As SPService
Dim value As Boolean
value = instance.AutoProvision
instance.AutoProvision = value
public virtual bool AutoProvision { get; set; }
Property value
Type: System.Boolean
true if the service is enabled; otherwise, false.
Remarks
This property is only writeable if the service does not support service applications. If the service supports service applications, the property is true when there are service applications and false when there are none.
If this property is true, SharePoint will pass the Role value of every server in the farm to the ShouldProvision(SPServerRole) method. If the method returns true (and the Role is not Custom), SharePoint will ensure that an instance of the service is provisioned on that server.
If the property is false, SharePoint will ensure that no instance of the service is provisioned on any server in the farm, except those servers whose Role is Custom. If the property is initially true and later set to false, a timer job will run within a couple of minutes that unprovisions the service from every server whose Role is not Custom.
SharePoint will neither provision nor unprovision the service automatically on servers whose Role property is Custom, regardless of the value of the AutoProvision property.
For more information, see MinRole overview.