Quantcast
Channel: OS|DC
Viewing all articles
Browse latest Browse all 64

CM\MDT : How to set variables list in Customsettings.ini

$
0
0

Tropical_Paradise_2

This is a tiny treasure I found while looking at something else in the MDT code, something that have been kept secret… until today…

Variables/Properties, in CM\MDT are for sure one of the coolest stuffs Microsoft brought to the table to make deployments dynamic. The usage is super easy : if you need more properties than the one already built in, edit the customsettings.ini file and add your new properties in  the [settings] section like this:

[Settings]
Properties=MySuperSecretPasswort,MyKillaProperty

Once staged, they can be used on the customsettings.ini file:

[Default]
MyKillaProperty=True

Or in a VB scripts:

If  oEnvironment.Item("MyKillaProperty") = "False"  Then Go_ToDie

Microsoft But wait.. There is more : you’ve probably noticed that some variables like Packages or Applications can handle multiple items like this:

Packages001=PR100028:Install - ACROBAT READER DC
Packages002=PR100029:Install - FLASH PLAYER
Packages003=PR10002D:Install - AGENT
Packages004=PR10002E:Install - ANTIVIRUS

How to create them ? fairly easy: by adding (*) characters to your properties declaration like this:

[Settings]
Properties=PinToTaskBar(*)

Now you can have your own variables list like this:

PinToTaskBar001=C:\windows\System32\calc.exe
PinToTaskBar002=C:\windows\notepad.exe

And use them  in yourscripts with the oEnvironment.ListItem() command, like that:

Dim oItem
For each oItem in oEnvironment.ListItem("PinToTaskBar")
PinToTaskBar oItem
Next

Yes that‘s pretty cool, and easy to use !

Hope you’ll have great fun playing with it !


Viewing all articles
Browse latest Browse all 64

Trending Articles