Jump to content

TNi2 Logon Script

Recommended Posts

Before, with TNi(1?), We had a script/Login script setup and it ran perfectly, most of it was generated from TNi itself, some came from support, but all integrated nicely with our main logon script, it worked fine, but we had endless problems with the process staying alive until the machine had been switched off.


But with TNi2, it doesnt appear to be as easy, i used the function to create it, set it all up how is needed, and generated the files, but it only gave me the new auditagent.exe no other files or script or anything, even when shown where the login scripts are, so i applied my common sense and re-used the script we had for the last one, all worked fine but had to grab the tniaudit.ini file from the old and drag it to the correct folder.


Although the data files are not being pushed into the right location, its dumping in where the agent is held, anyone know why?


if InStr(strOS, "Server") = 0 then
   Set wshShell = WScript.CreateObject("WScript.shell")
   wshShell.Run """\\ris-server\c$\TNI\Logon\TNi2\tniwinagent.exe""" & "/scripted" & "/path:"\\ris-server\c$\TNI\Data"
   Set wshShell = nothing


That is the code i tried (with the implied new wizard of login script) but didnt work so i had to use this:


if InStr(strOS, "Server") = 0 then
   Set wshShell = WScript.CreateObject("WScript.shell")
   wshShell.Run """\\ris-server\c$\TNI\Logon\TNi2\tniwinagent.exe""" & "/scripted"
   Set wshShell = nothing


Which works, and picks up the tniaudit.ini (which is i presume is the only thing telling where to dump the data files), but not going in the right place...any ideas?



Link to comment

Actually I don't believe the new "tniwinagent.exe" program for login script scanning uses the tniaudit.ini file anymore. The parameters are handled via command line options now.


We use a simple batch file for our login scripts and you can see an example below of how we do it:


IF "%SESSIONNAME%" == "Console" START \\server\share\FolderName\TNI2_DATA\tniwinagent.exe /scripted /path:\\server\share\FolderNAME\TNI2_DATA\"Human Resources" /delay:180 /overwrite



We check the environment variable %SESSIONNAME% is equal to 'Console' and if so, then execute the command. (If it isn't then it's a login session on a Citrix full desktop server in our environment.)


Then you can see we start the tniwinagent.exe program from a UNC path specified by the \\server\share parameter.


The /scripted parameter tells it this is running in a login script.


The /path parameter tells it where to put the resulting inventory file from the scan. In this example it gets put into a subfolder named \Human Resources on our server in that path. We specify different target paths in different login scripts for different offices in our environment for each of their login scripts.


The /delay parameter tells it how long to wait (in seconds) after executing the tniwinagent.exe program in our script before the actual inventory begins on the computer.


The /overwrite parameter tells the tniwinagent.exe program to "overwrite" the existing inventory file in your target location with the new one that just got completed in the last login. (If you don't use this parameter then you will get a new inventory file for each and every login that is named sequentially with a "(1)" naming scheme in the file name. We did not want our folders filling up with thousands of inventory files on the server for each and every login and using a single file overwriting it on each user login works best for us.

Link to comment
  • 2 weeks later...

Thanks for the exact and correct explanation, though there is another issue with VBS syntax.

tniwinagent.exe really doesn't use tniaudit.ini file anymore. Everything is done via command-line options.
But the problem is in VBS syntax. You have omitted spaces that should separate command-line parameters and also misused the quotes in the path parameter.
What you try to run currently looks like this (if we expand quotes):


(the command is truncated because the quotes embracing the path must be escaped exactly like in the EXE path, or not used at all, as there are no spaces in the path. You can even see the incorrect usage of quotes in your own post with the syntax highlighting this forum engine provides.

The correct line should look like this:

wshShell.Run """\\ris-server\c$\TNI\Logon\TNi2\tniwinagent.exe""" & " /scripted" & " /path:\\ris-server\c$\TNI\Data"

or this:

wshShell.Run """\\ris-server\c$\TNI\Logon\TNi2\tniwinagent.exe"" /scripted /path:\\ris-server\c$\TNI\Data"

You can find more information for settings up logon script scan in our user manual here.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...