Schuff at myITforum.com

Blog it to log it!

June 2008 - Posts

SCCM And Roles Wizard via MDT Database

For those of you that have tried to implement my previous Roles Wizard solution into your SCCM/MDT deployment, I would like to apologize it is a bit messy. :) Luckily I have trimmed down most everything that is no longer needed and simplied the process to add it to your deployment via SCCM!

You will still need the two wizard files that launch the Roles Wizard as included here in the zip. These have not changed from my last Roles Wizard update.  You will also need the SQL file or custom SQL code to create the roles view for you to query against, this is also included in the zip.

Download SCCMRolesWizard.zip Here  

(Updated  3/23/2011 - Fixed an issue with the roles not displaying in the menu even though they were found in the database)


Copy Files to the MDT Files Source Folder

  • Copy ZTERolesWiz_Scripts.vbs and ZTERolesWiz_Definition_ENU.xml files to the folder that is currently containing your MDT Files Package that you initially setup when you created your task sequence or MDT Files Package.

 

Update Customsettings.ini

  1. Open the customsettings.ini file found in the source of your MDT Settings package. This location and file should've already been created from creating an MDT Task Sequence as well.
  2. On the Priority list you will need to add the following two options:
    • SetShowRole
    • SelectableRoles
  3. On the Properties list you will need to add the following two options:
    • ShowRole
    • SelectableRole(*)
  4. Add the following two sections to your customsettings.ini file
    • [SetShowRole]
      ShowRole=1
    • [SelectableRoles]
      SQLServer=MYSERVER
      Database=BDDADMINDB
      Netlib=DBNMPNTW
      Table=SelectableRoles
      Parameters=ShowRole
      SQLShare=MDT_LOGS

 

      • P.S. Update the Database, SQLServer and SQLShare to values that correctly match your environment.

 Note:  Your customsettings.ini should already be configured with your database queries as well.

image

 

Create Custom Roles View in SQL

In order for the [SelectableRoles] section from the customsettings.ini (as shown above) to work we need to create the view in our MDT database within SQL. You can either open the .sql file included in the zip and execute it within SQL Management Studio or simply copy and paste the code below into a new query window and execute it.

  1. Open SQL Server Management Studio Console
  2. Copy and Paste the following code into a new query window and execute it. (Making sure that bddadmindb is set to your corresponding MDT database.
  • USE [bddadmindb]
    GO

    IF  EXISTS (select * from dbo.sysobjects where id = object_id(N'[dbo].[SelectableRoles]') and OBJECTPROPERTY(id, N'IsView') = 1)
    DROP VIEW [dbo].[SelectableRoles]
    Go

    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE VIEW [dbo].[SelectableRoles]
    AS
    SELECT     Role AS SelectableRole, 1 AS ShowRole
    FROM         dbo.RoleIdentity

    GO

image

Edit Task Sequence

  1. Next you need to add a task to the task sequence in the "New Computers only" folder within the "Preinstall" phase.
    • mshta.exe "%SCRIPTROOT%\Wizard.hta" /definition:ZTERolesWiz_Definition_ENU.xml
    • image

 

  1. You will also need to follow this task up with a new Gather task using CustomSettings.ini as your rules. This is required in order to process the Roles you have selected.

Note: Any Properties that you had already defined directly in the customsettings.ini or through an automated database query (such as Make/Model) will not be overwritten with the Roles Wizard selection. So make sure the properties you want to set via the Roles have not previously been set somewhere in the process.

Update distribution Points

  1. Right click and select "Update Distribution Points" on both your MDT Files Package and your MDT Settings Package so the new changes get copied to your distribution Points.

 

Done!

That's it, it should be done.  The Roles Wizard will prompt on the New Computer scenario only and display all Roles defined in the MDT Database. If you want to get fancy you can modify the custom Roles View to maybe even only show certain roles or such, the rest is up to you. 

Troubleshooting

If you are having troubles getting the roles to show up in the wizard or having the wizard show up at all you can Press F8 while in WinPE to open your command prompt (assuming you have this option enabled in your boot media) and open the C:\_SMSTaskSequence\Logs\bdd.log file for troubleshooting. Also you can always email me for questions.