0 Replies Latest reply on Sep 3, 2015 2:16 PM by Landon Winburn

    Identifying Network Condition Information

    Landon Winburn Expert
      This script can be added to a custom action at network connected and will report on the information needed to input into your session variable conditions.

      Set Fso = CreateObject("Scripting.FileSystemObject")
      Set F = Fso.OpenTextFile("c:\temp\" & GetEMSessionVariable("Network.Adapter.FriendlyName") & ".txt", 2, True)
      
      F.Writeline "Network.Adapter.FriendlyName: " & GetEMSessionVariable("Network.Adapter.FriendlyName")
      F.Writeline "Network.Adapter.Description: " & GetEMSessionVariable("Network.Adapter.Description")
      F.Writeline "Network.Adapter.Id: " & GetEMSessionVariable("Network.Adapter.Id")
      F.Writeline "Network.Adapter.IsVirtual: " & GetEMSessionVariable("Network.Adapter.IsVirtual")
      F.Writeline "Network.Adapter.IsWireless: " & GetEMSessionVariable("Network.Adapter.IsWireless")
      F.Writeline "Network.Domain: " & GetEMSessionVariable("Network.Domain")
      F.Writeline "Network.DomainType: " & GetEMSessionVariable("Network.DomainType")
      F.Writeline "Network.Id: " & GetEMSessionVariable("Network.Id")
      F.Writeline "Network.Adapter.BSSID: " & GetEMSessionVariable("Network.Adapter.BSSID")
      
      '============================================================
      'EM Auto Generated Start
      'This code was automatically inserted and should NOT be modified
      Function CreateTriggerContextVariableName(sessionVariableName)
       Set WshShell = WScript.CreateObject("WScript.Shell")
       Set WshProccessEnv = WshShell.Environment("Process")
      
       Dim sessVar
       Dim triggerContextId 
       triggerContextId = WshProccessEnv("TRIGGERCONTEXTID")
       if triggerContextId <> "" then
        sessVar =  triggerContextId & "." & sessionVariableName
       else
        sessVar =  sessionVariableName
       end if
      
       CreateTriggerContextVariableName = sessVar
      End Function
      
      Dim sessionVariableReader
      Function GetEMSessionVariable(name)
          GetEMSessionVariable = ""
      
          If (IsEmpty(sessionVariableReader)) Then
              Set sessionVariableReader = CreateObject("EMValue.EMGetValue")
          end if
              
          sessionVariableReader.Name = CreateTriggerContextVariableName(name)
          
          Dim errorCode
          errorCode = sessionVariableReader.Apply("")
          If errorCode = 0 Then
              GetEMSessionVariable = sessionVariableReader.Value
          end if        
      End Function
      'EM Auto Generated End
      '============================================================