Scripting problem: copy files to roaming profile
Hi people, I am deploying a solution (logon script in gpo) to copy a file (in a network shared folder) to a expecific userprofile folder (%userprofile%\windows) of all users. The script first deletes the file, and then copy the file again to the folder:if exist \\server1\profilepath\%username%\windows\file.ini del \\server1\profilepath\%username%\windows\file.ini copy \\server2\filepath\new\file.ini \\server1\profilepath\%username%\windows\file.ini The configuration per user is:- Roaming profile to : \\server1\profilepath\%username% UNC path.- GPO: Redirect of My documents, Desktop, App Data and My Programs to \\server1\DataUserPath\%username% UNC path.The fact is that the script deletes the file.ini (I saw it doing the logon), and copy&paste the new file.ini version. The problem is that the application that uses it, still using the old one, because of the roaming profile and the UNC paths that I have fix in the script. When the user log offs, the old file.ini returns to the UNC path of the profile.I tried to use %userprofile%\windows\file.ini in the script, but this didnt work, not recognice the sintaxis. Is there any way to copy&paste the file in the logon (using the roaming profiles...) and that the user starts to use it?, and dont beeing deleted in the log off process?thanks in advanced
February 17th, 2010 3:10pm

I would say it works that way by design.This is exactly how the roaming profile works. It works as follows:1. When the user logs on, the profile files from the server are downloaded to the user's profile folder on the local machine.2. When the user logs off, the profile files from the user's local machine are uploaded back to the server.You should consider:a) Using folder redirection instead of roaming profiles.b) copying a file from the network share to the %UserProfile%\Windows\file.ini
Free Windows Admin Tool Kit Click here and download it now
February 17th, 2010 6:01pm

Well, im using folder redirection and roaming profile, both of them:- Roaming profile to : \\server1\profilepath\%username% UNC path.- GPO: Redirect of My documents, Desktop, App Data and My Programs to \\server1\DataUserPath\%username% UNC path.Is there any problem about the desktop and Documents folder, because of they are both in the Redirect Folder GPO, and in the Roaming Profile ...?When I use Copy %userprofile%\path, it doesnt work....
February 17th, 2010 6:58pm

The logic in your login script is flawed.Basically, you are assuming that the login script runs before the profile is copied, that is not the case. What is happening is the profile is copied before your login script runs, so you are updating the stored users profile (just too late) NOT the user profile the user is currently using. That is the problem. This also explains why the wrong file is copied back.You need to stop updating the stored copy of the profile on the \\server1\profilepath and update the actual user profile stored local computer. The local computer profile is always stored in the %USERPROFILE% environment variable. Usually it points to "C:\Documents and Settings\%username%", but that can differ. Because it profile location can differe the the %USERPROFILE% is always the best option to use.Your script should be thisif exist %USERPROFILE%\windows\file.ini del %USERPROFILE%\windows\file.inicopy \\server2\filepath\new\file.ini %USERPROFILE%\windows\file.ini
Free Windows Admin Tool Kit Click here and download it now
February 17th, 2010 7:21pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics