@Kiyomi, Thanks for posting in Q&A. For the issue, I think the issue is that the variable under different account is different. For the script deployed from Intune, it has an option "Run this script using the logged on credentials". When we set it as Yes, it will run the script with the user's credentials on the device. Choose No to run the script in the system context Please check which value we set.
https://learn.microsoft.com/en-us/mem/intune/apps/intune-management-extension
Meanwhile, for the script, I find the command has some issue. You can change the "Copy-File" command to the following one to see if it works.
Copy-File -Path $dirFiles+'\Charts' -Destination $env:SystemDrive+'\Users\'+$CurrentUserName+'\AppData\Roaming'
Please check the above information and if there's any update, feel free to let us know.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.