It’s always quite a hassle if you want to copy a file to the current User Profile using SCCM, as the execution is in the SYSTEM context. One way of traversing this issue is to set Install as User for the Deployment Type. Using this method is however only possible if you are installing an application and the user also needs to be a local admin on the machine, which in most cases is not permitted.

Copy a file to the current user profile

If you want to copy files to the currently logged on user, you can use this workaround. This copies the file to all User profiles, except for the Public one. This works great if only one person logs in to the computer, but might not work well if more than one person logs in, as the file will be copied to all profiles in C:\Users.

ForEach ($user in (Get-ChildItem "C:\Users" -Exclude Public)) { Copy-Item -Path "MyFile.txt" -Destination "C:\Users\$user\AppData\Local\MyApp\MyFile.txt"

Related posts

Subscribe to newsletter:

If you want to receive the latest news for MEMCM, Windows 10, and Powershell, please subscribe to my monthly newsletter!



Please enter your comment!
Please enter your name here