-
Notifications
You must be signed in to change notification settings - Fork 107
SPServiceInstance
dscbot edited this page Mar 17, 2023
·
18 revisions
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
|
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.
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
}
}
}
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
}
}
}
- Home
- Getting Started
- Pre-requisites
- Installing the module
- Exporting SharePoint Configuration
- Creating Configuration Files
- Pre-created Examples
- Creating an Azure development environment
- Understanding Resources & Syntax
- Remote PowerShell Authentication
- Contributing to SharePointDsc
- Other useful modules for SharePoint DSC configurations