Push files to each user profile
Need to push two files to each user profile on each machine on our network.
C:\Users\jstrickland\AppData\Roaming\Microsoft\Templates is an example of the location I need to push the two files to.
My problem is how do I account for the different user profile names in the script?
I've tried %username% but that doesn't seem to work.
Any thoughts?
Answers (2)
Use %APPDATA%\Microsoft\Templates.
Comments:
-
Sorry that doesn't seem to work either.
I'm trying to unzip the folder directly into the location since I have two files that need to go into the folder. Should this go to all profiles on the machine or just the one that I'm signed in as? - AFCUjstrick 11 years ago-
Are you doing this through managed install? That will run as SYSTEM, and not recognize that directory. You will need to run this as a script as logged in user. - dugullett 11 years ago
-
Running it as a script. Just changed it to an Online Script and set it to run as All logged in users. Still no results in the user that is logged into the machine I'm testing this on. - AFCUjstrick 11 years ago
-
It needs to be "as user logged into console". - dugullett 11 years ago
-
Sadly still didn't work. Not sure what to try at this point. - AFCUjstrick 11 years ago
-
What are the steps you are taking in the script? Verify, Remediation, etc. - dugullett 11 years ago
-
" On success" Unzip the dependancy to %APPDATA%\Microsoft\Templates
That's all. - AFCUjstrick 11 years ago-
I've never unzipped a file there, but I'm wondering if you have the same results copying the file? Also see about changing the directory to C:\temp? Maybe there's an issue with the variable. I seem to recall reading that somewhere.
I'm assuming it works when you do not use the variable and put the exact path? - dugullett 11 years ago
-
Ok I'm unzipping to "C:\Install\Scripts" and the files both show up there.
Looks like that worked. Very strange since I tried these exact steps earlier, just with the
%UserName% variable instead of the %AppData% variable.
Thanks very much. - AFCUjstrick 11 years ago-
Not sure if it's related, but the release notes for 5.5 has this listed for resolved issues. Maybe it's not recognizing that one either?
3511: Scripts fail when the target path contains the variable %PROGRAMFILES%. - dugullett 11 years ago
-
Not sure why the unzip wasn't working, but the unzip and copy worked.
Thanks. - AFCUjstrick 11 years ago
I know you have an answer, but wanted to provide an alternative way. Say you to copy a file from the root of each profile on the system to a subfolder within the same profile on that system, you could do this in a batch. Note: This example is obviously for W7, but could be easily altered for other copies or XP
@echo off
cd /D C:\Users
for /D %%a in (*.*) do COPY /Y "%%a\file" "%%a\path\file.ext"
Comments:
-
interesting. - AFCUjstrick 11 years ago