Seite 1 von 1

Copy file to UserProfile

Verfasst: 29. Mär 2021, 15:10
von Boutta

I want copy file to UserProfile but doesn't work.

Sujet: Copy 1 image to UserProfile\appdata\....Uploads
UNC: %USERPROFILE%\AppData\Roaming\Microsoft\Teams\Backgrounds\Uploads

%SRC%\FILES\*" "%USERPROFILE%\AppData\Roaming\Microsoft\Teams\Backgrounds\Uploads"

I try with %SRC%\FILES\*" "c:\Temp"
That OK :)

I try with %WindowsUser% and %OsLogin% doen't work :(

I need your help please.



Re: Copy file to UserProfile

Verfasst: 29. Mär 2021, 22:38
von ctearney
when we want to build a package that copies a file to a user profile or run an executable under the user context we always add a step to the setup.inf that stages the files we are wanting to work with to a directory on the local machine that all users have access to first. For example, in our baseline image we create a folder on the root of C: called "Company" and set the permissions to it so that all "authenticated users" have full control of the folder.

In the inf file we add a machine copy section which copies the needed files from %SRC% to this location. Then we add a section to the inf file for "Client" which will execute or copy those files using the user context.

So you will have something like this.


The "Stage Users Files" section will copy the needed files to the local directory you create and then the "Client Config" section will execute the action using that directory as the new source. For example:

[Set:Stage User Files]
1:%Src%\1PasswordSetup-7.6.780.exe, C:\Company\1PasswordSetup-7.6.780.exe

[Set:Client Config]
AddMeter -1
Call "C:\Company\1PasswordSetup-7.6.780.exe" --silent
If "%ErrorLevel%" <> "0" Then "SET:InstallationError" EndIf

Re: Copy file to UserProfile

Verfasst: 30. Mär 2021, 16:01
von Boutta

Thank for your reply.

I try:

[Create Folder]
MkDir "C:\Temp\Fond_Teams" >>>> OK

[Copy SRC]
Copy "%SRC%\Files\*" "C:\Temp\Fond_Teams" >>>>> OK

[Copy Fond_Teams]
Copy "C:\Temp\Fond_Teams\*" "%USERPROFILE%\AppData\Roaming\Microsoft\Teams\Backgrounds\Uploads" >>>> doesn't work. :(

Maybe i'm not doing the right things.

Re: Copy file to UserProfile

Verfasst: 13. Apr 2021, 14:33
von Hendrik_Ambrosius
Does that last command run in the user part?
The call should look like this:
#Copy Fond_Teams,CLIENT