ConfigMgr 2012–Create Console Folder Items
For those of you that might be interested in automating some of your folder structures for your ConfigMgr 2012 Hydration or test labs the following should help guide you on how to create Console Folder Items in ConfigMgr 2012. There is a decent amount of available options and I will try and provide them in the below table:
| ObjectType | ObjectTypeName |
| 5000 | SMS_Collection_Device |
| 5001 | SMS_Collection_User |
| 31 | SMS_Application |
| 2 | SMS_Package |
| 17 | SMS_StateMigration |
| 9 | SMS_MeteredProductRule |
| 11 | SMS_ConfigurationItem |
| 2011 | SMS_ConfigurationBaselineInfo |
| 7 | SMS_Query |
| 1011 | SMS_SoftwareUpdate |
| 25 | SMS_Driver |
| 23 | SMS_DriverPackage |
| 18 | SMS_ImagePackage |
| 14 | SMS_OperatingSystemInstallPackage |
| 19 | SMS_BootImagePackage |
| 20 | SMS_TaskSequencePackage |
Below are the required parameters for creating Consoler Folders:
Name, ObjectType, ObjectTypeName, parentContainerNodeID
The following is an example script creating A Application Console Folder Item Structure. Use the table above to create any console folder item you would like to have.
Or you can download the script from the following Link.
Disclaimer: This code was created and tested on ConfigMgr 2012 (Beta) 2 and is subject to change.
'/////////////////////////////////////////////////////////////////////////////////////////////////////
'//
'// Script: CreateConsoleFolderItem.vbs
'//
'// Purpose: Used to Create console Folder Items
'//
'// Usage: cscript CreateConsoleFolderItem.vbs
'//
'// Version: 1.0 - 04 Sept 2011 - Brandon Linton
'//
'// Disclaimer: This script is provided "AS IS" with no warranties, confers no rights and
'// is not supported by the authors or Inkbal Consulting, LLC.
'//
'//
'/////////////////////////////////////////////////////////////////////////////////////////////////////
Dim objFolder, NewContainerNodeID, aNewContainerNodeID, newfolder, newfolderpath
' Setup a connection to the local provider.
Set swbemLocator = CreateObject("WbemScripting.SWbemLocator")
Set swbemconnection= swbemLocator.ConnectServer(".", "root\sms")
Set providerLoc = swbemconnection.InstancesOf("SMS_ProviderLocation")
For Each Location In providerLoc
If location.ProviderForLocalSite = True Then
Set swbemconnection = swbemLocator.ConnectServer(Location.Machine, "root\sms\site_" + Location.SiteCode)
Exit For
End If
Next
'// Create Application Console Folders
'// Create Application Console Root Folder
Call CreateConsoleFolder(swbemconnection, Location.SiteCode & " - Applications", 31, "SMS_Application",0)
'// Set Root Folder Variable for use later
set aNewContainerNodeID = NewContainerNodeID
'// Create Application Console Folders under Root Folder
Call CreateConsoleFolder(swbemconnection, "Adobe", 31, "SMS_Application", NewContainerNodeID)
Call CreateConsoleFolder(swbemconnection, "Microsoft", 31, "SMS_Application", aNewContainerNodeID)
Call CreateConsoleFolder(swbemconnection, "Oracle", 31, "SMS_Application", aNewContainerNodeID)
Call CreateConsoleFolder(swbemconnection, "Dell Inc.", 31, "SMS_Application", aNewContainerNodeID)
Call CreateConsoleFolder(swbemconnection, "Cisco", 31, "SMS_Application", aNewContainerNodeID)
Call CreateConsoleFolder(swbemconnection, "Citrix", 31, "SMS_Application", aNewContainerNodeID)
Call CreateConsoleFolder(swbemconnection, "7zip", 31, "SMS_Application", aNewContainerNodeID)
Sub CreateConsoleFolder(swbemconnection, name, objectType, objectTypeName, parentContainerNodeID)
Set newfolder = swbemconnection.Get("SMS_ObjectContainerNode").SpawnInstance_()
newfolder.Name = name
newfolder.ObjectType = objectType
newfolder.ObjectTypeName = objectTypeName
newfolder.ParentContainerNodeID = parentContainerNodeID
set newfolderpath = newfolder.Put_
set NewContainerNodeID = newfolderpath.Keys("ContainerNodeID")
End Sub