Wednesday, March 20, 2013

Getting started with Michael Niehaus’s MDT module

Michael Niehaus published his MDT PowerShell Database module on May 15, 2009.
URL: http://blogs.technet.com/b/mniehaus/archive/2009/05/15/manipulating-the-microsoft-deployment-toolkit-database-using-powershell.aspx
this plugin is an extension to the standard MDT plugins and modules. it is targeted to the MDT database opposite most other MDT plugin’s that are mainly created to help you to modify the deployment share and its contents.
Unfortunately Michaels own blog is not very helpful in the application of the module so in this post i would like to help you to get started.


Organization of the Functions

The plugins are grouped into 5 units: new- ,set- ,get- ,clear- and remove -MDT*
All create-able and settable MDT items are handled generally in the same way:
  1. retrieve the Object ID
  2. set the Object with the option: –settings
the –settings property's are set individually like –settings (OSInstall=”Yes”) or with a hash table like –settings @(objectitem1=”text”;objectitem2=”text”;objectitem3=”text”}
The settings that can be used in the hash table are published on my blog on URL: http://negyuhsit.blogspot.nl/2013/03/mdt-computer-object-property-details.html
Each function group has the same kind of commands. let’s look at them right now.


New-MDT functions

The New-MDT*  group is the first group of all functions in this module. these functions are for the single purpose of the creation of MDT Objects
CommandType Name
----------- ----
Function New-MDTComputer
Function New-MDTLocation
Function New-MDTMakeModel
Function New-MDTPackageMapping
Function New-MDTRole
Syntax of New-MDTComputer: New-MDTComputer identifier –description OSDComputerName –settings @(objectitem1=”text”;objectitem2=”text”;objectitem3=”text”}

the identifier variable deserves some extra clarification: as identifier of a MDT object the following items can be used; at least one of them has to be defined:

-assetTag           uses the assetTag as identifier                     example:  E123456
-macAddress     uses the MAC address as identifier             example:  00:12:34:56:78
-serialNumber  uses the serialnumber of the machine          example:  12345678
-UUID              uses the UUID as identifier                          example: 329800735698586629295641978511506172918 (more information about UUID’s can be found on this link)

Syntax of New-MDTLocation:  New-MDTLocation –name LocationName –gateways IPADDRESSGW1,IPADDRESSGW2 –settings @(objectitem1=”text”;objectitem2=”text”;objectitem3=”text”}

Syntax of New-MDTMakeModel: New-MDTMakeModel –make Makename (example: HP, Dell) –model ModelName settings @(objectitem1=”text”;objectitem2=”text”;objectitem3=”text”}

Syntax of New-MDTPackageMapping: New-MDTPackageMapping –ARPName –package used to create mapping to packages on external systems like SCCM

Syntax of New-MDTRole: New-MDTRole –name RoleName settings @(objectitem1=”text”;objectitem2=”text”;objectitem3=”text”}


Set-MDT* and Get-MDT*

Of the next two groups Set-MDT* and Get-MDT* ,the first function is the one that realy does configure MDT Objects. they do this in the following way:
Get-MDT* –ID mdtitemID –settings @(objectitem1=”text”;objectitem2=”text”;objectitem3=”text”}
The second function (Get-MDT*) is mainly there to fetch MDT object and to extract their ID's to use them in a Set command.
The way to retrieve the object ID is done like this: (Get-MDTComputer -macAddress $mac).ID where the MAC address is in a format like nn:nn:nn:nn:nn but offcourse the other three object identifiers can also be used to retrieve the object ID.
Another way to retrieve the ID of an object is to open the MDT MMC and look for the object, the ID is found in the table and in the GUI Tabs:

image

CommandType Name
----------- ----
Function Set-MDTArray
Function Set-MDTComputer
Function Set-MDTComputerAdministrator
Function Set-MDTComputerApplication
Function Set-MDTComputerPackage
Function Set-MDTComputerRole
Function Set-MDTLocation
Function Set-MDTLocationAdministrator
Function Set-MDTLocationApplication
Function Set-MDTLocationPackage
Function Set-MDTLocationRole
Function Set-MDTMakeModel
Function Set-MDTMakeModelAdministrator
Function Set-MDTMakeModelApplication
Function Set-MDTMakeModelPackage
Function Set-MDTMakeModelRole
Function Set-MDTPackageMapping
Function Set-MDTRole
Function Set-MDTRoleAdministrator
Function Set-MDTRoleApplication
Function Set-MDTRolePackage
Function Set-MDTRoleRole

CommandType Name
----------- ----
Function Get-MDTArray
Function Get-MDTComputer
Function Get-MDTComputerAdministrator
Function Get-MDTComputerApplication
Function Get-MDTComputerPackage
Function Get-MDTComputerRole
Function Get-MDTLocation
Function Get-MDTLocationAdministrator
Function Get-MDTLocationApplication
Function Get-MDTLocationPackage
Function Get-MDTLocationRole
Function Get-MDTMakeModel
Function Get-MDTMakeModelAdministrator
Function Get-MDTMakeModelApplication
Function Get-MDTMakeModelPackage
Function Get-MDTMakeModelRole
Function Get-MDTRole
Function Get-MDTRoleAdministrator
Function Get-MDTRoleApplication
Function Get-MDTRolePackage
Function Get-MDTRoleRole

The Clear-MDT* group

This group functions generally the same like the  Get-MDT* group. just like that function, MDT objects are cleared like this: Clear-MDT* –ID MDTObjectID
CommandType Name
----------- ----
Function Clear-MDTArray
Function Clear-MDTComputerAdministrator
Function Clear-MDTComputerApplication
Function Clear-MDTComputerPackage
Function Clear-MDTComputerRole
Function Clear-MDTLocationAdministrator
Function Clear-MDTLocationApplication
Function Clear-MDTLocationPackage
Function Clear-MDTLocationRole
Function Clear-MDTMakeModelAdministrator
Function Clear-MDTMakeModelApplication
Function Clear-MDTMakeModelPackage
Function Clear-MDTMakeModelRole
Function Clear-MDTRoleAdministrator
Function Clear-MDTRoleApplication
Function Clear-MDTRolePackage
Function Clear-MDTRoleRole

Remove-MDT* group

This group is the opposite of the New_MDT* group: it removes MDT objects from the MDT database.
They function generally the same like the Set- and Get-MDT* groups. just like those functions the MDT object are removed like this: Remove-MDT* –ID MDTObjectID
CommandType Name
----------- ----
Function Remove-MDTComputer
Function Remove-MDTLocation
Function Remove-MDTMakeModel
Function Remove-MDTPackageMapping
Function Remove-MDTRole

All groups have some main functions like –verbose these are used for level of feedback to the user.

Tags van Technorati: ,,,,

No comments:

Post a Comment