[download id=”28″]

When you create AD user accounts through Active Directory Users and Computers, they don’t appear in the SBS Console. And therefore it is not possible to manage them from the Console.

Run this VB script to add user accounts to the SBS console. Be sure to define the OU location for your users before running the script.

The script don’t add disabled accounts.

' //***************************************************************************
' //***************************************************************************
' // ***** Script Header *****
' //
' // Solution:  SBS Console
' // File:      AddUsersToSBSConsole.vbs
' // Author:    Brian Fahrenholtz, Coretech A/S. https://blog.ctglobalservices.com
' // Purpose:   Add Active Directory user accounts to the SBS Console
' //
' // Usage:     AddUsersToSBSConsole.vbs
' //
' //
' // CORETECH A/S History:
' // 1.0.0  BFA 27/01/2011  Created initial version.
' //
' // Customer History:
' //
' // ***** End Header *****
' //***************************************************************************
' //----------------------------------------------------------------------------
' //  Main routines
' //---------------------------------------------------------------------------- 

' Defines the OU location for user accounts
' Remember to define the user location before running the script
' Default adds users located in SBSUsers
strSearchOU = "OU=SBSUsers,OU=Users,OU=MyBusiness,DC=SBSDomain,DC=local"

' Create the ADO Recordset Object
Set rs = CreateObject("ADODB.Recordset")

' Open the Record Set based on the arguments
rs.Open "<LDAP://"& strSearchOU & ">;(&(objectClass=User)(!(userAccountControl:1.2.840.113556.1.4.803:=2)));adspath;subTree", "provider=ADsDSOObject"

Do Until rs.EOF
	'Create an instance of a user object from AD
	Set oUser = GetObject(rs.Fields("adspath"))

	'Update the local property cache value using the Put method
	oUser.Put "msSBSCreationState", "Created"

	'Write the local property cache back to AD
	oUser.SetInfo

	rs.MoveNext
Loop

'//----------------------------------------------------------------------------
'//  End Script
'//----------------------------------------------------------------------------

Thanks to Jakob for providing me the code samples.