Returns configuration information for all the Terminal Service session directories found on a computer.

JavaScript
Edit|Remove
var wbemFlagReturnImmediately = 0x10;
var wbemFlagForwardOnly = 0x20;

   var objWMIService = GetObject("winmgmts:\\\\.\\root\\CIMV2");
   var colItems = objWMIService.ExecQuery("SELECT * FROM Win32_TSSessionDirectory", "WQL",
                                          wbemFlagReturnImmediately | wbemFlagForwardOnly);

   var enumItems = new Enumerator(colItems);
   for (; !enumItems.atEnd(); enumItems.moveNext()) {
      var objItem = enumItems.item();

      WScript.Echo("Caption: " + objItem.Caption);
      WScript.Echo("Description: " + objItem.Description);
      WScript.Echo("Session Directory Active: " + objItem.SessionDirectoryActive);
      WScript.Echo("Session Directory Cluster Name: " + objItem.SessionDirectoryClusterName);
      WScript.Echo("Session Directory Expose Server IP: " + 
          objItem.SessionDirectoryExposeServerIP);
      WScript.Echo("Session Directory Location: " + objItem.SessionDirectoryLocation);
      WScript.Echo("Setting ID: " + objItem.SettingID);
      WScript.Echo();
   }