Author: Ron Ratzlaff (aka “The_Ratzenator”)

Date: 7\22\2014

New Configuration Manager 2012 Console Folder Tool

The help information provided below can also be viewed by using the following syntax:

Get-Help New-CM12ConsoleFolder –Full

NAME

New-CM12ConsoleFolder

SYNOPSIS

The "New-CM12ConsoleFolder" function will attempt to create a folder in the SCCM 2012 management console.

SYNTAX

New-CM12ConsoleFolder [-FolderName] <String[]> [-FolderType] <String[]> [-ParentContainerNodeId] <Int32[]>

[<CommonParameters>]

DESCRIPTION

You may have noticed that the "New SCCM 2012 Management Console Folder Tool" does not have a SiteCode or a

SiteServer parameter for the user to specify. This is because it will first attempt to retrieve the SCCM 2012 SMS

Provider information automatically from the local computer's WMI repository. If it cannot successfully retrieve

the SCCM 2012 SMS Provider information from the WMI repository, it will notify the user that either the SCCM 2012

Client may not be installed on the local system, or there may be an issue with the WMI repository itself. The user

will then be prompted to specify a 3 digit SCCM 2012 Site Code, and computer name of the SCCM 2012 Site Server.

When specifying an SCCM 2012 Site Code, the script will not allow more or less than 3 alphanumeric characters

since an SCCM 2012 Site Code must be 3 characters in length, no more and no less. If the user does not specify the

correct character length consisting of alphanumeric charaters when being prompted for the SCCM 2012 Site Code,

they will be notified that they have entered it incorrectly. If this occurs, then the user will keep being

prompted to enter it correctly due to the looping process. You will use the abbreviation (shown in parenthesis in

the "SCCM 2012 Management Console Folders List" below) of each "Folder Type Name" rather than the "Folder Type

Values" to specify in which location the folder will be created in, within the SCCM 2012 Management Console. The

"New SCCM 2012 Management Console Folder Tool" also allows for the creation of multiple folders.

----SCCM 2012 Management Console Folders List----

The following list below shows the SCCM 2012 management console folders that can be created programmitcally via

PowerShell:

--All Folders--

- Folder Type Name: Package Folder (PF); Folder Type Value: 2

- Folder Type Name: Query Folder (QF); Folder Type Value: 7

- Folder Type Name: Software Metering Folder (SOMF); Folder Type Value: 9

- Folder Type Name: Operating System Installer Folder (OSINF); Folder Type Value: 14

- Folder Type Name: State Migration Folder (SMF); Folder Type Value: 17

- Folder Type Name: Operating System Image Folder (OSIMF); Folder Type Value: 18

- Folder Type Name: Boot Image Folder (BIF); Folder Type Value: 19

- Folder Type Name: Task Sequence Folder (TSF); Folder Type Value: 20

- Folder Type Name: Driver Package Folder (DPF); Folder Type Value: 23

- Folder Type Name: Driver Folder (DF); Folder Type Value: 25

- Folder Type Name: Software Update Folder (SUF); Folder Type Value: 1011

- Folder Type Name: Configuration Baseline Folder (CBF); Folder Type Value: 2011

- Folder Type Name: Device Collection Folder (DCF); Folder Type Value: 5000

- Folder Type Name: User Collection Folder (UCF); Folder Type Value: 5001

- Folder Type Name: Application Folder (AF); Folder Type Value: 6000

- Folder Type Name: Configuration Item Folder (CIF); Folder Type Value: 6001

--Assets and Compliance Folders--

- Software Metering Folder (SMF)

- Configuration Baseline Folder (CBF)

- Device Collection Folder (DCF)

- User Collection Folder (UCF)

- Configuration Item Folder (CIF)

--Monitoring Folders--

- Query Folder (QF)

--Software Library Folders--

- Package Folder (PF)

- Operating System Installer Folder (OSINF)

- State Migration Folder (SMF)

- Operating System Image Folder (OSIMF)

- Boot Image Folder (BIF)

- Task Sequence Folder (TSF)

- Driver Package Folder (DPF)

- Driver Folder (DF)

- Software Update Folder (SUF)

- Application Folder (AF)

PARAMETERS

-FolderName <String[]>

A mandatory parameter used to name the folder that the user wants to create in a specified location within the

SCCM 2012 Management

Console.

Required? true

Position? 1

Default value

Accept pipeline input? true (ByValue, ByPropertyName)

Accept wildcard characters? false

-FolderType <String[]>

A mandatory parameter used to specify the actual location within the SCCM 2012 Management Console the folder

will be created in.

This parameter uses the "ValidateSet" attribute to allow only the following "Folder Type Name" abbreviations

to be used as

illustrated in the "SCCM 2012 Management Console Folders List" section above:

Folder Type Name Abbreviations

- PF = Package Folder

- QF = Query Folder

- SOMF = Software Metering Folder

- OSINF = Operating System Installer Folder

- SMF = State Migration Folder

- IPF = Image Package Folder

- BIF = Boot Image Folder

- TSF = Task Sequence Folder

- DPF = Driver Package Folder

- DF = Driver Folder

- SUF = Software Update Folder

- CBF = Configuration Baseline Folder

- DCF = Device Collection Folder

- UCF = User Collection Folder

- AF = Application Folder

- CIF = Configuration Item Folder

Required? true

Position? 2

Default value

Accept pipeline input? true (ByValue, ByPropertyName)

Accept wildcard characters? false

-ParentContainerNodeId <Int32[]>

A manadatory parameter used to specify in which parent node location the new folder should be located in. To

create the new folder in

the root of a particular node the value of "0" will be used. If you want to create a folder within an already

existing folder, you

will need to retrieve the Parent Node ID of that particular folder object in order to use that instead.

Required? true

Position? 3

Default value

Accept pipeline input? false

Accept wildcard characters? false

<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).

INPUTS

OUTPUTS

------EXAMPLE 1 ------

C:\PS>To create a single Device Collection Folder (DCF) with the name of "New CM12 Folder Test", use the following

syntax:

New-CM12ConsoleFolder -FolderName "New CM12 Folder Test" -FolderType "DCF" -ParentContainerNodeId "0"

------EXAMPLE 2 ------

C:\PS>To create multiple folders you can use an array as shown in the following syntax:

This example illustrates how to create multiple Device Collection folders.

New-CM12ConsoleFolder -FolderName @("New CM12 Folder Test 1", "New CM12 Folder Test 2") -FolderType "DCF"

-ParentContainerNodeId "0"

------EXAMPLE 3 ------

C:\PS>To create multiple folders you can use a file (.txt or .csv).

This example illustrates how to create multiple Operating System Installer folders.

New-CM12ConsoleFolder -FolderName (Get-Content -Path "$env:TEMP\CM12FolderList.txt") -FolderType "OSINF"

-ParentContainerNodeId "0"

------EXAMPLE 4 ------

C:\PS>To create multiple folders in multiple locations simply use the "New-CM12ConsoleFolder function more than

once in a script.

This example illustrates how to create multiple Device Collection folders along with multiple Operating System

Installer folders.

New-CM12ConsoleFolder -FolderName @("New CM12 Folder Test 1", "New CM12 Folder Test 2") -FolderType "DCF"

-ParentContainerNodeId "0"

New-CM12ConsoleFolder -FolderName (Get-Content -Path "$env:TEMP\CM12FolderList.txt") -FolderType "OSINF"

-ParentContainerNodeId "0"

RELATED LINKS