9 Replies Latest reply on Jun 24, 2011 7:37 AM by derekhamaker

    Help Overwriting a file at log on

    derekhamaker Apprentice

      I need some help with a script/process to be able to overwrite a file at each login.

      Here is my situation:

       

      First, I understand that some settings I state below may not be "best" but they are how they are in our environment.  That's it.

       

      We are using SAP 7.20 PL6.  For those unfamiliar with SAP 7.20, it stores its saplogon.ini file (server configuration file) in the user application folder (%appdata%\sap\common)

      This is different than SAP 7.10, which stored it's saplogon.ini file in c:\windows.

      Our user base does not have admin rights, which allowed us to completely control the saplogon.ini while it resided only in c:\windows.  We used a GPO script to overwrite c:\windows\saplogon.ini at logon.  It allowed centralized management of the file.

      That same control now needs to be in place with 7.20.  But now, the user has full control over their own profile and possibly "muck-up" their server connections.

       

      Also to note: when you launch SAP 7.20, it first looks for saplogon.ini in %appdata%\sap\common.  If it find it there, it uses that file.  If it does not find it there, it looks to c:\windows.  If c:\windows\saplogon.ini exists, it copies it to %appdata%\sap\common then uses the file from the userprofile.  If c:\windows\saplogon.ini does not exist, SAP opens with a blank server configuration (and creating a blank %appdata%\sap\common\saplogon.ini file).

       

      Okay....

      I would like to be able to control the saplogon.ini file that the users have, all out of LANDesk (not GPO).

      I have run through several scripts, but have come up with the Batch file I have attached to this post.

       

      I have the batch file in a Local Scheduler Script:

      [MACHINES]
      REMEXEC0=<qt/>%LDMS_CLIENT_DIR%\LocalSch.exe<qt/> /del /range=%quote%1001|2000%quote%
      REMEXEC1001=<qt/>%LDMS_CLIENT_DIR%\LocalSch.exe<qt/> /exe=%quote%"\\PATH_TO_BATCH FILE\Support_ini.bat"%quote% /cmd=<qt/><qt/> /taskid=10001 /freq=900 /toe=logon /start=%quote%08 Feb 2011 10:47:55%quote%

       

      My issue now, is that this batch file does not run silent.  It is obtrusive.  It pops up in the user's face.  It does happen at login (at most every 15 min)...but sometimes it doesn't run for 10 minutes after login.  Deleting all the saplogon.ini files takes some time, so if a user opens SAP while the script is running (after del saplogon.ini /s but before the new file is copied to c:\windows), they will get a blank server configuration - with the only solution, to reboot after 15 min.

      So basically, I want to be able to control the saplogon.ini file, with some mechanism that is silent.

       

      Can you all help?

      I know I just dropped a lot of info, so please ask if I can clarify anything.

       

      thanks!

      -Derek

        • 1. Re: Help Overwriting a file at log on
          Catalysttgj Expert

          First thing that comes to mind is that you're using the /toe=logon switch. You really need that to happen EVERY time someone logs on so the /freq=900 is not good for that. I'd recommend you make two separate tasks. One where the /toe=logon is used, and one where it is not used. Let each task do the same work, but set the /freq=1 on the one that has /toe=logon. That way it will probably work better for catching each logon. On the one that you have running every 15 minutes, you won't include the /toe=logon switch at all. It should just run at every 15 minutes as desired. There is a log file for the localsch.exe. You'll probably be seeing errors in there now that is stating that the task has run too soon, and has to wait. That's why you're seeing the sort of random delay on its start. Its actually waiting for the 900 seconds to actually complete. This could be any amount of time from 900 seconds down to just a few, so that's why i say its sort of Random because its the delta of time in between logons and that 900 seconds expiring. By making two separate tasks you'll solve that problem.

           

          I'm looking closer at your batch file now, just to see what is going on, but the above should still hold up, so wanted to share that with you now.

          • 2. Re: Help Overwriting a file at log on
            Catalysttgj Expert

            Also, you should be able to incorporate the use of the Hidedos.exe to solve the problem for it showing up. Look for it in the C:\Program files\LANDesk\LDclient directory.

            1 of 1 people found this helpful
            • 3. Re: Help Overwriting a file at log on
              Catalysttgj Expert

              Alternatively, you might want to figure out a way to call this batch file with another caller batch file would just use the START command using the MIN switch to minimize this batch file onto the task bar. This way, if someone wants to, they can actually call it up, but it wouldn't jump in their face every time.

               

              Make sense?

              • 4. Re: Help Overwriting a file at log on
                derekhamaker Apprentice

                Hey....thanks for the replies.

                I had tried using another batch file to use start "" /min ......... and that worked to run the saplogon.ini script minimized, but it left the other batch file open for all to see.  And if I recall correctly, it did not close automatically when complete, even with exit at the end.

                 

                As for HideDos.exe, we are running 9.0sp2 (just upgraded from sp1 this past weekend) so we don't have hidedos.exe on the clients.  But I did find this thread from 2008 with the file uploaded.

                I will experiment with it.

                 

                I am updating my script now to remove the 15min interval.  And if I can get this process completely silent, then I can definitely have it run regularly throughout the day.

                 

                On a side note - is a local scheduler the best method for this?  Sparxent helped us with our inital deployment of 9.0sp1 last year with a 6 month engagement that ended 1/2011.  This was Mike Jager's recommendation.  Not sure if anyone else has any real world experience with the need to continuously replace files.

                 

                Thanks again!

                -D

                • 5. Re: Help Overwriting a file at log on
                  derekhamaker Apprentice

                  ok - so preliminary testing looks good for hidedos.exe to make it silent.  I will be updating my script to use this

                   

                  hidedos.exe "Path_to_batch.bat"

                  • 6. Re: Help Overwriting a file at log on
                    EMiranda Expert

                    I think i understand what you want to do with your saplogon.ini.  Does it have to be done at log on? is there any specific reason for that?  My suggestion is to just create a LANDesk distribution package (batch file) or you could do a managed script (either way will work)

                     

                    create a batch file like this:

                     

                    Win7

                     

                    @ECHO off
                    
                    Set src="C:\saplogon.ini"
                    Set dest="AppData\sap\common\saplogon.ini"
                    Set user_path="C:\Users\"
                    
                    for /d %%a in (%user_path%*) do copy %src% %%a\%dest% /Y
                    
                    exit /B
                    

                     

                     

                    WinXP

                     

                     

                    @ECHO off
                    
                    Set src="C:\saplogon.ini"
                    Set dest="Application Data\sap\common\saplogon.ini"
                    Set user_path="C:\Documents and Settings\"
                    
                    for /d %%a in (%user_path%*) do copy %src% %%a\%dest% /Y
                    
                    exit /B
                    

                     

                     

                    This batch file will copy and override the existing saplogon.ini on all the local profile folders on the machine. (you will have to update the source with the correct path to the correct saplogon.ini you want to use.  If you do a distrubution package you can include it and just set the path to C:\program files\landesk\ldclient\sdmcache\etc..).

                     

                    This way you can control it and you dont have to wait for a user to log in (what if one never does...)

                     

                    I used copy assuming the folder structure is there, if it is not, then you might want to switch out copy with xcopy and use the /I switch

                    • 7. Re: Help Overwriting a file at log on
                      Catalysttgj Expert

                      ideally, you'd want to avoid local scheduler since its not exactly that simple to manage it through the LANDesk console. It adds a layer of complexity, but it is a good choice if you need something to happen at logon and at short intervals. Since the minimum repeat time for a task from the server is much longer than 15 minutes, its about as good as it gets. Myself, I'd just incorporate it into a logon script, but then again, if there's special permissions needed then local scheduler can beat that as well. In our environment we have a logon script that can run as both user and as an admin with all the permissions needed to do whatever, so for us logon script works fine, and we've not come into a situation where we needed to replace a file constantly like this.

                       

                      Are users really screwing with this file that frequently? I would think a once at logon would be more than adequate, and if a user broke their stuff, the service desk's standard reply would be, log out and log back in again, and see if it fixes it. Also, a good reason to squeeze in a reboot too, since we are talking about Windoze! :-)

                      • 8. Re: Help Overwriting a file at log on
                        MarXtar ITSMMVPGroup

                        The fewer local scheduler tasks you have the better because of the management difficulties. I'd agree with the last statement that once per user session 'should' be plenty since you are doing a lot of work for what might be a very rare ocurrence. I'd be interested to know how frequently they do manage to screw that info up though.

                         

                        If you have quite a few of these issue you might want to consider virtualising the apps so that they are fully standardised. Bit of overkill for just one app but maybe worth considering as a wider strategy.

                         

                        Mark McGinn

                        MarXtar Ltd

                        http://www.marxtar.com

                         

                        The One-Stop Shop for LANDesk Enhancements

                        - Wake-On-WAN - Distributed Wake-On-LAN, Scheduled Power Down, and SWDist Sequencing

                        - Inventory Change & Root Cause Analysis

                        - Self-Service Password Reset

                        - PC Power Management

                        - Help/Service Desk Integration

                        - LANDesk Data Manipulation/Integration/Bar Coding

                        - LANDesk Executive Reporting Pack

                        - Network Asset Discovery and Management

                        - LANDesk Software Store

                        • 9. Re: Help Overwriting a file at log on
                          derekhamaker Apprentice

                          Okay everyone...thanks for the great feedback.  I've taken a combination of several of your posts and worked something new that works perfectly.

                          I'll post below and attach what I did.

                           

                          As for the file.....we have never really had an issue with people screwing it up.  But also consider it was kept in c:\windows.  And without admin rights, you could not manipulate that file anyway.

                          Personally, I don't have much of a concern about the employees, even the sales reps <gasp!> messing the file up, but our Basis group is concerned about "what-if's."  I figure we identified it as a risk, and we have a way to manage it with this script, so lets go.

                          Also - we needed to be able to update it on the fly.  We are in the middle of another project scope migrating another 24 ERP systems globally to SAP over the next 2-3 years, so having dynamic access to the INI file is beneficial.

                           

                          So here is my Local Scheduler Script:

                          [MACHINES]

                          REMEXEC0=<qt/>%LDMS_CLIENT_DIR%\LocalSch.exe<qt/> /del /range=%quote%1001|2000%quote%

                          REMEXEC1001=<qt/>%LDMS_CLIENT_DIR%\LocalSch.exe<qt/> /exe=%quote%\\DFSpath\global\software\landesk\packages\SAP\720-Medical\INI_Files\hidedos.exe \\DFSpath\global\software\landesk\packages\SAP\720-Medical\INI_Files\SupportINI.bat%quote% /cmd=<qt/><qt/> /taskid=10010 /freq=600 /toe=logon /start=%quote%23 Jun 2011 08:39:11%quote%

                           

                           

                          I chose a /freq=600 because of the option listed to repeat and 10 minutes is the lowest in the GUI.  I tried choosing without a repeat option, thinking it would just run at login, but it runs one time, then deletes itself.

                          As far is any issues with the 10 min repeat, I don't see any, so don't have any issues with it being there.

                           

                          I also kept the Batch file and all saplogon.ini files on our network server, so nothing will happen if the user happens to be offline.

                           

                          The hidedos command gave me exactly what I was looking for with XP.

                          As I type this, I realized I did not include the commands for 7 to stop the UI0Detect service.  So I'll test in 7 again and see if I need it.

                           

                          Thanks again for everyone's help!

                          -Derek