# Thursday, June 14, 2007

Holy moly, I've gone script crazy!

Here's another little script that helps with the installation of Commerce Server 2007 (perhaps when I'm all done, I'll consolidate them all into an uber-script).  This script creates the Business Management Administrator Windows groups, which are used to control authorization roles within the Authorization Manager.

This script creates four Windows groups (CatalogAdminGroup, MarketingAdminGroup, ProfilesAdminGroup, and OrdersAdminGroup) and then assigns users to those groups.

Without further ado, here's the script:

' ===================================================================
' Author:      Wade Wegner
' Create date: 06/14/2007
' Description: Automate the creation and assigning of Windows Groups
' File Name:   CreateAndAssignCSGroups.vbs
' ===================================================================

' Set the local computer name. Unlike other examples, use the computer name,
' rather than "."; the AssignUserToGroup method requires the actual name
strComputer = "CS2007"

strCatalogAdminGroup = "CatalogAdminGroup"
strMarketingAdminGroup = "MarketingAdminGroup"
strProfilesAdminGroup = "ProfilesAdminGroup"
strOrdersAdminGroup = "OrdersAdminGroup"
strIISWorkerProcessGroup = "IIS_WPG"

' Run the Load method
Load

' Encapsulates the processing of this script
Sub Load()

   ' Create the windows groups
   CreateWindowsGroup strCatalogAdminGroup, "Catalog administration group"
   CreateWindowsGroup strMarketingAdminGroup, "Marketing administration group"
   CreateWindowsGroup strProfilesAdminGroup, "Profiles administration group"
   CreateWindowsGroup strOrdersAdminGroup, "Orders administration group"

   ' Add any users you desire
   AssignUserToGroup "Administrator", strCatalogAdminGroup
   AssignUserToGroup "Administrator", strMarketingAdminGroup
   AssignUserToGroup "Administrator", strProfilesAdminGroup
   AssignUserToGroup "Administrator", strOrdersAdminGroup

   ' This adds the various service accounts to the IIS_WPG group, so that the
   ' services can run as the identity for IIS app pools
   AssignUserToGroup "RunTimeUser", strIISWorkerProcessGroup
   AssignUserToGroup "CatalogWebSvc", strIISWorkerProcessGroup
   AssignUserToGroup "MarketingWebSvc", strIISWorkerProcessGroup
   AssignUserToGroup "OrdersWebSvc", strIISWorkerProcessGroup
   AssignUserToGroup "ProfilesWebSvc", strIISWorkerProcessGroup

   Msgbox "Complete!"

End Sub

' Create the Windows group
Sub CreateWindowsGroup(groupName, description)

   Set objComputer = GetObject("WinNT://" & strComputer & "")
   Set objGroup = objComputer.Create("group", groupName)

   objGroup.Description = description
   objGroup.SetInfo

End Sub

' Assign the user to the Windows group
Sub AssignUserToGroup(userName, groupName)

   Set objGroup = GetObject("WinNT://" & strComputer & "/" & groupName & ",group")
   Set objUser = GetObject("WinNT://" & strComputer & "/" & userName & ",user")

   objGroup.Add(objUser.ADsPath)

End Sub

Pretty straightforward.  Nothing too fancy or flashy.

CreateAndAssignCSGroups.vbs (1.98 KB)

I hope someone fiinds this helpful!

Sunday, June 17, 2007 1:04:49 PM (Central Standard Time, UTC-06:00)
Very useful installation scripts

Wade Wegner published on his blog 3 very useful posts about how to automate processes which usually are taking most of the time during installation.

http://blog.vuscode.com/malovicn/archive/2007/06/13/commerce-server-2007-developer-boot-camp-day-1.aspx
Tuesday, June 26, 2007 1:17:21 AM (Central Standard Time, UTC-06:00)
Nikola,

I am glad that you found a use for these scripts. If you can think of any other tasks that would benefit from scripting, let me know!

Best regards,

Wade
Name
E-mail
Home page

Comment (Some html is allowed: a@href@title, b) where the @ means "attribute." For example, you can use <a href="" title=""> or <blockquote cite="Scott">.  

Enter the code shown (prevents robots):

Live Comment Preview