TIA WinCC RT Pro. Load Windows UserName via VBS.

SIMATIC S7-200/300/400, Step7, PCS7, CFC, SFC, PDM, PLCSIM,
SCL, Graph, SPS-VISU S5/S7, IBHsoftec, LOGO ...
Lexiy
Posts: 9
Joined: Tue May 25, 2010 3:47 am

TIA WinCC RT Pro. Load Windows UserName via VBS.

Post by Lexiy » Thu May 13, 2021 8:10 am

Hi all.
I start WinCC Runtime Professional on PC as Service with Local User "Scada_Runer". PC in domain. The domain user logs in via RDP and starts the Graphics Runtime. There will be several users in total and I will need to save user actions, which parameters they have changed. I don't want to use Siemens users on the TIA portal. These are unnecessary actions for users. And I've already got the functionality I need.

I want to load Windows User Name via VBS. I found three ways to do this. I start VBScript by time each 2 mins.

Code: Select all

' Test WScript.Network --------------
Dim strWindowsUser
strWindowsUser = CreateObject("WScript.Network").UserName
HMIRuntime.Tags("CurWinUser").Write strWindowsUser
' -----------------------------------

' Test Shell User ----------------
Dim wshShell, strShellUser
Set wshShell = CreateObject("WScript.Shell")
strShellUser = wshShell.ExpandEnvironmentStrings("%USERNAME%")
HMIRuntime.Tags("ShellUserTag").Write strShellUser
' -----------------------------------

' Test AD System Info ---------------
Dim objSysInfo, strUserDN
Set objSysInfo = CreateObject("ADSystemInfo")
strUserDN = objSysInfo.userName
HMIRuntime.Tags("ADSysUserTag").Write strUserDN
' ------------------------------------
But it is not working. In the first time i have true user name and on next time and more i have user name "Scada_Runer" (Under this user started RunTime Core).
Now i fount only one way. Checking UserName after load and if it = "Scada_Runer" then do not save. But i do not like this way. In this case i load true user name only one time after login.

Please help. Maybe it can be solved somehow?