Okay, so here’s another useful script. 

Commerce Server 2007 requires you to give service accounts write permissions to various files and folders.  This script assigns the write permissions to the Catalog Web service, the Temporary ASP.NET folder, and the Windows Temporary folder.  These permission allow you to run the Business User applications through the Business Management Web services.

In order to run this script, you must have the XCACLS.vbs file available.  Learn more about this VBScript here, and download it here.

Here’s the script:

‘ ==========================================================
‘ Author:      Wade Wegner
‘ Create date: 06/13/2007
‘ Description: Automate the task of assigning permissions
‘ File Name:   AssignCSPermissions.vbs
‘ ==========================================================

‘ Declare the users
Dim users(4)
users(0) = “RunTimeUser”
users(1) = “CatalogWebSvc”
users(2) = “MarketingWebSvc”
users(3) = “OrdersWebSvc”
users(4) = “ProfilesWebSvc”

‘ Run the Load method
Load

Sub Load()

   ’ Write permissions to the catalog auth role
   strObject = “C:InetpubwwwrootCatalogWebServiceCatalogAuthorizationStore.xml”
   UpdatePermissions strObject, users(1)

   ’ Write permissions to temporary ASP.NET folder
   strObject = “C:WINDOWSMicrosoft.NETFrameworkv2.0.50727Temporary ASP.NET Files”
   For Each user IN users
      UpdatePermissions strObject, user
   Next 

   ’ Write permissions to the Windows temporary folder
   strObject = “C:WINDOWSTemp”
   For Each user IN users
      UpdatePermissions strObject, user
   Next

End Sub

‘ Update the permissions of the folder/file
Sub UpdatePermissions(strLocation, strUser)

   Set objShell = CreateObject(“Wscript.Shell”
   ’ Make sure to have the xcacls.vbs file available. Download from:
   ’ http://download.microsoft.com/download/f/7/8/f786aaf3-a37b-45ab-b0a2-8c8c18bbf483/xcacls_installer.exe
   objShell.Run “xcacls.vbs “”" + strLocation + “”" /G “ + strUser + “:XW /E”, 2, True<
/SPAN>

End Sub

* Note that, in order to run this script, you may have to run “cscript.exe /h:cscript” from the command prompt, which changes the default scripting engine from Wscript to Cscript.

After running this script, you will have updated the permissions and you didn’t have to do it manually!

AssignCSPermissions.vbs.txt (1.5 KB)

I hope this helps!

  • Gokul

    This is a cool piece of code… Thanks Wade :)

    I encountered a trivial error in the code.
    you might want to update your code below… ‘strUser’ is not defined, instead you would want to use ‘user’

    For Each user IN users
    UpdatePermissions strObject, strUser
    Next

  • http://blog.wadewegner.com/ Wade Wegner

    Gokul,

    Thank you very much for pointing this out! I have updated the post and the attached VBScript.

    Many thanks!