-
Notifications
You must be signed in to change notification settings - Fork 107
SPFarmAdministrators
Parameter | Attribute | DataType | Description | Allowed Values |
---|---|---|---|---|
Name | Key | String | A generic name for this resource, its value is not important | |
Members | Write | String[] | A list of members to set the group to. Those not in this list will be removed | |
MembersToInclude | Write | String[] | A list of members to add. Members not in this list will be left in the group | |
MembersToExclude | Write | String[] | A list of members to remove. Members not in this list will be left in the group | |
InstallAccount | Write | String | POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 |
This resource is used to manage the membership of the farm administrators group. There are a number of approaches to how this can be implemented. The "members" property will set a specific list of members for the group, making sure that every user/group in the list is in the group and all others that are members and who are not in this list will be removed. The "MembersToInclude" and "MembersToExclude" properties will allow you to control a specific set of users to add or remove, without changing any other members that are in the group already that may not be specified here, allowing for some manual management outside of this configuration resource.
This example shows how to set a specific list of members for the farm admins group. Any members not in this list will be removed.
Configuration Example
{
param(
[Parameter(Mandatory = $true)]
[PSCredential]
$SetupAccount
)
Import-DscResource -ModuleName SharePointDsc
node localhost {
SPFarmAdministrators LocalFarmAdmins
{
Name = "Farm Administrators"
Members = @("CONTOSO\user1", "CONTOSO\user2")
PsDscRunAsCredential = $SetupAccount
}
}
}
This example shows how certain changes are made to the farm admins groups. Here any members in the MembersToInclude property are added, and members in the MembersToExclude property are removed. Any members that exist in the farm admins group that aren't listed in either of these properties are left alone.
Configuration Example
{
param(
[Parameter(Mandatory = $true)]
[PSCredential]
$SetupAccount
)
Import-DscResource -ModuleName SharePointDsc
node localhost {
SPFarmAdministrators LocalFarmAdmins
{
Name = "Farm Administrators"
MembersToInclude = @("CONTOSO\user1")
MembersToExclude = @("CONTOSO\user2")
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