Hi SteveWH,
I have conducted a simple test by adjusting your VBscript. Instead of the user environment variables, I used the entries from the registry. I checked both logon and reconnect. Both worked as expected and changes were written to the example.log file. Also when I switch to another client/endpoint, this information (client name/IP) is updated and written to the example.log file.
Here's the adjusted VBscript. You can make your own adjustments and test.
--
Dim filesys, filetxt, getname, path
Set filesys = CreateObject("Scripting.FileSystemObject")
Set filetxt = filesys.OpenTextFile("\\SERVER\SHARE\example.log", 8)
Set WshNetwork = WScript.CreateObject("WScript.Network")
Set WshShell = WScript.CreateObject("WScript.Shell")
Set WshSysEnv = WshShell.Environment("Volatile")
varFound = "false"
Do
WScript.Echo "variable does not exist yet"
WScript.Sleep 2000
If NOT WshShell.RegRead("HKEY_CURRENT_USER\Volatile Environment\ViewClient_Broker_DNS_Name") = "" Then varFound = "true"
Loop Until varFound = "true"
path = filesys.GetAbsolutePathName("\\INFRA01.lab.local\UEM_ProfileArchives\testuser01\example.log")
getname = filesys.GetFileName(path)
strViewClient_Broker_DNS_Name = WshShell.RegRead("HKEY_CURRENT_USER\Volatile Environment\ViewClient_Broker_DNS_Name")
strViewClient_Machine_Name = WshShell.RegRead("HKEY_CURRENT_USER\Volatile Environment\ViewClient_Machine_Name")
strViewClient_IP_Address = WshShell.RegRead("HKEY_CURRENT_USER\Volatile Environment\ViewClient_IP_Address")
strViewClient_Protocol = WshShell.RegRead("HKEY_CURRENT_USER\Volatile Environment\ViewClient_Protocol")
filetxt.WriteLine( "LOGON " + WshNetwork.UserName + " " + WshNetwork.ComputerName + " " ) & now() & ( " " + strViewClient_Machine_Name + " " + strViewClient_IP_Address + " " + strViewClient_Broker_DNS_Name + " " + strViewClient_Protocol )
filetxt.Close
--
I hope this helps.