Page 3 of 3 <123
Topic Options
#185438 - 2008-02-18 04:50 PM Re: Kix+Forms+Active Directory [Re: Mart]
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Not quite the full story.

The problem is that you cannot rely on the "user" part of the path being @USERID.

For various reasons Windows will decide that the local version of the users profile is invalid or unusable, so it will create a new directory. A common cause is that you lose read / write permission to the directory.

Depending on the version of Windows, the new directory may include the domain name, or it may use an increasing numeric suffix, i.e. "jdoe.001".

The only way to know which one of the profiles really applies to the user is to rip the expanded path from the registry (or use %USERPROFILE%)

Top
#185440 - 2008-02-18 05:07 PM Re: Kix+Forms+Active Directory [Re: Richard H.]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4396
Loc: New Jersey
 Quote:
duo
$inifile="C:\Documents and Settings\duo\Desktop\newlogscript\sample.ini"

This is a configuration file, and placing it in the user folder is probably not a good idea, whether hard coded or not. If this is a config file for the login script, it should probably be referenced as \\%USERDOMAIN%\netlogon\%USERID%.ini

Every one of our systems has a specific place for scripts, and another for common (shared) configuration files. These are defined by Environment Variables S_BIN and S_CONFIG. This way, one script knows where other scripts are found, and always knows where to find local config files.

Just another way to skin the (mmrrrrroOOOWWWWWW) cat!

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#185446 - 2008-02-18 09:16 PM Re: Kix+Forms+Active Directory [Re: Arend_]
duo Offline
Getting the hang of it

Registered: 2007-10-25
Posts: 61
Loc: iowa
 Originally Posted By: apronk
didn't try on vista yet but wouln't %userprofile% and %appdata% provide the corrent paths in all OS's ?



No they do not(for what i need), case in point

Server 03
S:\>echo %appdata%
C:\Documents and Settings\username\Application Data

S:\>echo %userprofile%
C:\Documents and Settings\username


Vista
S:\scripting\newlogscript>echo %userprofile%
C:\Users\username

S:\scripting\newlogscript>echo %appdata%
C:\Users\username\AppData\Roaming


03/XP dont use appdata for location of users start menu


Edited by duo (2008-02-18 09:17 PM)

Top
#185454 - 2008-02-19 01:42 AM Re: Kix+Forms+Active Directory [Re: Mart]
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
 Originally Posted By: Mart
I think Les means to say that one should never hardcode the username (eg. jsmith) but use the @userid macro so if a users gets renamed stuff will still work. This way it will work for all users it applies so you don’t have to create separate scripts or lines for each user.
No, both are evil as has already been explained.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
Page 3 of 3 <123


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 539 anonymous users online.
Newest Members
Timothy, Jojo67, MaikSimon, kvn317, kixtarts2025
17874 Registered Users

Generated in 0.063 seconds in which 0.028 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org