This action is running on QNA and also on server, however when i am pushing this action through BigFix on desktop/laptop then it is not getting completed.
After pushing this fixlet, backup folder is creating, and chrome process is killing but not copying the files and folders from source to destination.
$env:USERPROFILE is not going to resolve as you expect because the action will be running as LocalSystem, not as the account of a logged-on user.
You’ll need to either change the logic to loop through all of the user profiles instead of relying on $env, or use action overrides to execute the script in the context of a logged-on user instead of LocalSystem. I have some notes on the action overrides settings at Tip - Action Override User settings that may be useful.
If you just want to copy the Chrome profile of the logged-on user then Jason’s action overrides solution will accomplish this.
If you want to backup the Chrome profiles for every user on a computer who has one, I have a script for that. I added the destination you specified to the $destination variable.
NOTE: Both your original script and my below script as it currently is will copy only the DEFAULT Chrome profile from Appdata for each user. If there are additional profiles for a Windows user, this script won’t copy it. If you want to copy ALL Chrome profiles, you can edit the script to copy the entire “User Data” folder. Or you can get a little more complicated with the script so it can identify all folders in the “User Data” folder whose contents would indicate it is a profile folder.