ggirten
(Fresh Scripter)
2008-01-24 09:06 PM
Identifying user specific file

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


Les
(KiX Master)
2008-01-24 09:41 PM
Re: Identifying user specific file

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.

ggirten
(Fresh Scripter)
2008-01-24 09:53 PM
Re: Identifying user specific file

OK, can you give a hint?

Mart
(KiX Supporter)
2008-01-24 09:54 PM
Re: Identifying user specific file

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 


ggirten
(Fresh Scripter)
2008-01-24 10:20 PM
Re: Identifying user specific file

Thanks for the info. I think you have pointed me on the right track.