Back to basics: How can I add computers to Active Directory Groups during OSD with SCCM (System Center Configuration Manager)

Introduction

Following up on my promise and continuing this mini-series of blog post, where I’m trying to address some of the basics of Configuration Manager. This time, I’m going to give you an example of how you can to add computers to groups in AD (Active Directory) during the deployment of Windows using a web service and Powershell.

Sneak peek at the available operations in the web service

Web Service

As mentioned, this is based on using a web service. There are other options as well, but I recommend using a web service due to various factors, and in general, a web service extends the functionality of OSD considerably. It might seem scary to someone, but its actually really easy to put to use. Below are the details:

  • First of all, you obviously need the web service installed and functional. My example is based on Nickolaj Andersen’s web service. The installation is well documented alongside the download: http://www.scconfigmgr.com/configmgr-webservice/
  • The installation is literally next, next, next and done

Once the web service has been installed, the prerequisite for this option is to grant the service account access (the identity account), to allow modifying group memberships in Active Directory.

Taking a closer look at the Advanced Settings of the ConfigMgrWebService Application Pool will reveal the account used (in case you didn’t do the installation yourself, or somehow forgot which user that’s running the web service). See below.

Active Directory

  • To give the account access to modify group memberships in Active Directory, right click on the OU where the group you plan on adding computers reside and select Delegate Control

  • Add the account as shown below

  • Delegate the Modify the membership of a group permissions and finish the wizard

Powershell

Nickolaj is kind enough to provide us with some Powershell samples included in the web service. I have made some minor changes allowing the computer to be added to several groups. Copy/paste the script below or make your own edition if needed.

  • Insert your own SecretKet from the web service
  • Modify groups to suit your needs
  • Insert your own URL to the web service

Task Sequence

Put everything to use in your task sequence. Below illustrates the use in one of my task sequences.

Enjoy 🙂

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.