Reading MDT Variables

To read a variable in MDT using VBScript, you can use the following script:

set env = CreateObject("Microsoft.SMS.TSEnvironment")
Valeur = env("OSDComputerName")
WScript.Echo "The value of OSDComputerName is: " & Valeur

This script creates an instance of the `TSEnvironment` object and reads the value of the `OSDComputerName` variable.

Writing MDT Variables

To write a value to an MDT variable, you can use the following script:

set env = CreateObject("Microsoft.SMS.TSEnvironment")
env("OSDComputerName") = "NewComputerName"
WScript.Echo "The OSDComputerName has been set to: " & env("OSDComputerName")

This script sets the value of the `OSDComputerName` variable to “NewComputerName”.


0 Comments

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.