2 Replies Latest reply on Sep 23, 2016 8:52 AM by Guy_Walton

    Script to update Network Logins

    Brian.Subia Apprentice

      I am fairly new to Service Desk and SQL so I’m looking for help.


      I work or a large school district and I am running into an issue that I’m hoping can be helped with a script.  On average we have about 5-7 users a month who change names. Our system has been configured so that on initial import of a user the Network Login is set based on the LoginID we have imported. This works great until the name change.


      I have found the document describing how to set Logins automatically (DOC-4602) but it’s not clear if this would also update the Logins. Has anyone been able to create or would be able to point me in a direction to create a script that would compare the Network Login to the LoginID we have imported for our users and update the Network Login if they are different?

        • 1. Re: Script to update Network Logins
          andreas.lindner Expert

          Hi Brian,


          if you're using the script from the DOC-4602, then everything should be fine. The script is aware of name changes (the "Name" in Service Desk is the login name) and thus it should set all network logins in the correct way. So for everything to work in order, you have to ensure that:

          1. Either users are being imported regularly OR that all name changes also happen in Service Desk. The script uses the attribute Name (tps_name) from the user to build the network login.
          2. The sp_SetNetworkLogin es being executed regularly (preferably daily over night). To do so, use a Maintenance Plan on your SQL Server and let the SQL Server run this stored procedure ("exec sp_SetNetworkLogin").

          So if you're running both actions regularly, then all network logins should match the users.


          Sometimes it happens, that Service Desk needs the tps_is_primary to be set for the primary network login. If you have more than one network login per user, that will be mandatory. If there is only one network login per user, then it is a good idea to set the value but it should work anyways. If you do not see the attribute on the Network Login window, just open the Console and go to the Designers - Window Manager - System - User Network Login and add the attribute to the window.


          If you've got only one network login per user, then you can amend the script (in the original script that you can download these will be lines 43 and 44):

          insert into tps_user_network_login (tps_guid,tps_user_guid,tps_network_login,tps_is_primary)
               values (newid(),@guid,@networkLogin,1)

          That will ensure, that the one networklogin, you have per user, is marked as primary network login.


          Hope that helps!



          • 2. Re: Script to update Network Logins
            Guy_Walton Apprentice

            just a quick question ... do you have a link to  DOC-4602 ?


            Thank you



            never mind ... just found it


            How to set Network Logins for your Users automatically