Copy files to AppData Local
Wade
Hi there
We're using PDQ deploy pro and wanted to copy an xml file to all user profiles (windows 7) to this location %USERPROFILE%\AppData\Local
When I use the path above it only copies the files to the existing profile that PDQ is using which is a domain admin account on the machine that i'm testing.
How can i copy it to all user profiles
0
Comments
Hello!
That is a great question! The reason that it's only copying your file to your PDQ account profile is because the %USERPROFILE% is a user environment variable. That means that it's specific to the user account that's using it.
If you log in as User1 and look at the %USERPROFILE% environment variable, it will show C:\Users\User1. If you log in as User5 and look at the %USERPROFILE% environment variable, it will show C:\Users\User5.
Since the PDQ Deploy account is connecting to your target as the Deploy User, it will use the %USERPROFILE% for your Deploy User.
Personally, I'm fond of PowerShell (check out my blog!), so here's how you could copy a file into each users directory by using PowerShell. I'm traversing each directory in C:\Users by utilizing a wildcard (*) and then I'm looping through and copying each file based upon the results:
I've also attached a couple of screenshots as examples. Best of luck to you!
Cheers,
Edit: I cleaned up my text and added some extra explanations. I hope they're helpful!
Kris,
From my understanding on PowerShell, the target PC would need to have certain execution policies enabled in order to run this.
Is there an easier way without powershell to accomplish the same thing? perhaps a batch file or using the target folder options in the package properties of PDQ Deploy?
PowerShell should work with Deploy by default unless you enforce extra restrictions.
When they launch powershell during a deployment they actually start the process like this: powershell.exe -ExecutionPolicy Bypass (I think it's bypass, might not be), regardless, they launch powershell with the ability to run powershell scripts.
So yes, the powershell code above should work just fine barring any ridiculous security policies being applied to the system.