→ 🚀What's New? Join Us for the Fall Product Launch! Register Now !

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
NYNet
Engaged Sweeper III
I currently have the lsclient.exe executed at logon via GPO. Everything works great but when a user logons to my Terminal server it executes that script on the server itself. When I do a search for a specific user it brings up the user and the last pc the user was logged onto was the term server. That makes it difficult to find out what workstation the user is currently at. Is there a way to exclude the logon script from executing on certain servers/workstations on logon via the vbs script ran in the GPO?
2 REPLIES 2
ejensen
Engaged Sweeper III
I have done this in the past for various scripts. Basically you check to see if the session is rdp and if it is, then bypass parts of your script.

Here is an example, I am sure there are others out there, probably more elegant than mine.


IF "A%clientname%A" == "AA" goto normal_login

goto end

:normal_login
cscript \\server\path-to-script-here
:end


On a workstation the "Clientname" environment variable is set to Console. Same for a rdp /console session.
Let me know how that works.
NYNet
Engaged Sweeper III
I know I keep doing this but I figured it out again and want to share the information incase anyone else needs to do the same. My logon.vbs script is as follows:

' Start of script
Set WshShell = CreateObject("WScript.Shell")
ComputerName = WshShell.ExpandEnvironmentStrings("%COMPUTERNAME%")
if (computername = "Terminal server name1" OR computername = "terminal server name2) then
'WScript.Echo Computername - this stament is commented out but it would verify the term server is being excluded if uncommented-
else
WshShell.run "\\SERVERNAME\netlogon\lsclient.exe servername" ,0
end if

' END of script

if you wanted to inventory your Terminals servers you can run "lsclient servername" manually on each individual server or create an OU in AD and have another GP for your Term. server logons to run on every logon and exlude the if statement in that logon.vbs.

Hope this helps!