SPServiceInstance - dsccommunity/SharePointDsc GitHub Wiki
Parameters
| Parameter | Attribute | DataType | Description | Allowed Values |
|---|---|---|---|---|
| Name | Key | String | The name of the service instance to manage | |
| Ensure | Write | String | Present to ensure it runs on this server, or absent to ensure it is stopped | Present, Absent |
Description
Type: Specific Requires CredSSP: No
This resource is used to specify if a specific service should be running (Ensure = "Present") or not running (Ensure = "Absent") on the current server. The name is the display name of the service as shown in the Central Admin
The default value for the Ensure parameter is Present. When not specifying this parameter, the service instance is started.
Examples
Example 1
This example shows how to ensure that the managed metadata service is running on the local server.
Configuration Example
{
param
(
[Parameter(Mandatory = $true)]
[PSCredential]
$SetupAccount
)
Import-DscResource -ModuleName SharePointDsc
node localhost
{
SPServiceInstance ManagedMetadataServiceInstance
{
Name = "Managed Metadata Web Service"
Ensure = "Present"
PsDscRunAsCredential = $SetupAccount
}
}
}
Example 2
This example shows how to ensure that the Business Data Connectivity Service is not running on the local server.
Configuration Example
{
param
(
[Parameter(Mandatory = $true)]
[PSCredential]
$SetupAccount
)
Import-DscResource -ModuleName SharePointDsc
node localhost
{
SPServiceInstance StopBCSServiceInstance
{
Name = "Business Data Connectivity Service"
Ensure = "Absent"
PsDscRunAsCredential = $SetupAccount
}
}
}