Hi everyone,
Firstly apologies I’m very new to Powershell and PSADT.
I’m trying to copy some Teams Background files to the Users profiles and set a registry Key using PSADT and Intune. This Works on my test laptop when when running the script as as Admin.
When I deploy to the machine through Intune the registry key gets added but the files do not copy to the user profile. Do you have any ideas why this might not be working.
I have the script set to Run as an Admin so not sure if I need to run the file copy to the User Profile as the logged in User?
Thank you so much for the reply and the useful information
I’ve tested out the first suggestion using $usersLoggedOn
The files are still not copying to the Users profile. I’ve tested other locations on my PC and the copy works successfully, so just the issue getting it into the current logged on users profile. If you have any other suggestions I’d be most grateful
I don’t understand how you got GWD\JNCA in the destination path. (weird)
I forgot to strip out the domain name and add *C:\Users* in front of the username.
Here’s an updated listing:
#log list of all logged-on users for troubleshooting.
$usersLoggedOn | Out-String | write-log
#Strip out the domain name and add **C:\Users\** in front of the username.
$CurrentUserProfile = $($usersLoggedOn[0]).replace("GWD",'C:\users')
#Copy Teams backgrounds to the first logged-on user in the array
Copy-File -Path "C:\homeworking\Teams Backgrounds\*.*" -Destination "$CurrentUserProfile\AppData\Roaming\Microsoft\Teams\Backgrounds\Uploads"
Please, remember that this hack will only work for the user that launches the SCCM App.
If you want better, you’ll have to use Active Setup.
This worked!!! Thank you so much!!
This app will only run when the user is logged in so this we should be okay there.
Honestly thank you this has been a great help