Page 1 of 1 1
Topic Options
#184819 - 2008-01-24 09:06 PM Identifying user specific file
ggirten Offline
Fresh Scripter

Registered: 2002-02-27
Posts: 7
I need to check in my logon script to see if the user has MS Word, then copy a file to their user directory. I can't seem to figure out how to check user specific. I have tried many combinations of the if statement.

If Exist ("C:\Documents and Settings\"+@userid+"\Application Data\Microsoft\Templates\Normal.dot")
copy @lserver+"\netlogon\Normal.dot" "C:\Documents and Settings\"+@userid+"\Application Data\Microsoft\Templates\"
Endif

Top
#184821 - 2008-01-24 09:41 PM Re: Identifying user specific file [Re: ggirten]
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
You should never embed @UserID in the path but rather pull the path from the registry. The reason and method has been discussed here many times.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#184824 - 2008-01-24 09:53 PM Re: Identifying user specific file [Re: Les]
ggirten Offline
Fresh Scripter

Registered: 2002-02-27
Posts: 7
OK, can you give a hint?
Top
#184825 - 2008-01-24 09:54 PM Re: Identifying user specific file [Re: Les]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4672
Loc: The Netherlands
A little example.

You could also use the environment variable %appdata%.

 Code:
Break on

$appdata = ReadValue("HCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders", "AppData")

If Exist ($appdata + "\Microsoft\Templates\Normal.dot")
	Copy @lserver+"\netlogon\Normal.dot" $appdata + "\Microsoft\Templates\"
EndIf 
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#184827 - 2008-01-24 10:20 PM Re: Identifying user specific file [Re: Mart]
ggirten Offline
Fresh Scripter

Registered: 2002-02-27
Posts: 7
Thanks for the info. I think you have pointed me on the right track.
Top
Page 1 of 1 1


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

Who's Online
2 registered (morganw, mole) and 414 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.049 seconds in which 0.022 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