TS variables are stored and managed using a COM object, namely 
Microsoft.SMS.TSEnvironment. Thus, you need to simply create a new instance of 
this COM object.


The following should work to do this:


objTS = 
Activator.CreateInstance(Type.GetTypeFromProgID("Microsoft.SMS.TSEnvironment"));


Remember of course that this will only work during a pre-execution 
hook/pre-start command (assuming you have the .Net component added to your 
WinPE boot image) or during the actual execution of a TS (and if that is during 
the the WinPE phase the same caveat about .Net added to the boot image goes).


J

________________________________
From: [email protected] <[email protected]> on behalf 
of Atkinson, Wade A <[email protected]>
Sent: Tuesday, September 2, 2014 9:40 AM
To: [email protected]
Subject: [MDT-OSD] VB.Net Application accessing TS Variables

Has anyone been able to access / modify the TS Variables using a VB .NET 
application.  It's very simple with Visual Basic, but as we move to SCCM 2012 
we will also be moving to a 64bit boot environment.  My VB apps used to make 
SQL calls will no longer work, so I am attempting to migrate them to .NET.

Any examples would be appreciated.  I have tried to get the COM object to work 
with no luck.

Thanks,
Wade




Wade Atkinson, MCSE, Lead IT Engineer
IS Workplace Technology
_______________________________________________________________________________________________________________________________
CenturyLink | 600 New Century | New Century KS 66031
office 913 738 5766 | cell 913 744 5455


Reply via email to