Setting System Variables

We use SAP and when moving from the 710 client to the 720 we came across an odd error. We install using the a SAP server distribution point and then change the SAPLogon.ini file in the Windows directory so the user get the correct links available to them depending on their role. This worked fine for 710 but on some systems users were getting the default settings only and it seems that sometime the install defaults to looking for the saplogon.ini file in the user's Appdata\Common\SAP folder. this in itself is a good thing but a bit of a nightmare to mange across several hundred PC, before we would just copy an ini file to the windows directory and all users on that PC got the same things now we potentially had to manage that ini file in multiple users accounts which gets bit more involved on teh scripting side.


I then came across an article that mentioned the SAPLOGON_INI_FILE system variable. You can set this so that it looks at a central location on the PC and then your life is back to normal. Almost


On the face of it setting a system variable is a simple thing. You go in to the system properties dialog ad on the advanced tab there is a button marked Environment Variables. Click it and then enter you user or system variable.
Job done. But what if you wanted to create a system variable on say 20 or 30 or even 100 PCs?

Well if you Use Altiris or some other way to install software and manage your PCs you can run scripts locally on the PC, so is there a script you can run?

XP had a little utility that came in teh resource kit that did just that. It is called SETX. It is avaible as standard in Windows 7.

The script you would use is some thing like
SETX Variable_Name Variable_Value
This will set the value as a user variable, if you want to set it as System variable you need to a /M on the end.

I now use the following,

SETX SAPLOGON_INI_FILE C:\Windows\SAPLOGON.INI /M

You will need to run this in an admin context on Windows 7.

You could chose to run the this as part of a logon script and set it as a user variable depending on job requirements so you could copy over a normal, Tester and developer saplogon.ini files with different names and then the user would always have the right options where ever they logged on.

It is also possible to amend the install to point to a network location for the SAPLOGON.ini but you are then in to managing multiple installs of SAP which can get cumbersome.

Comments

Popular posts from this blog

Scripting DNS entries

Enterprise Vault - Failed Exchange Task

Windows Phone to iPhone - a painful transition