Hello,
I created a Profile-Cleaner with different functions for the user in our company.
One of the function is to Copy Files from a folder ($sourcePath) to the C-Drive ($desinationPath)
The script works only, if you run it as admin. But 99% of the users can’t run this as admin since they don’t have permissions for that.
Do any of you know of a workaround to achieve this without having to enter my credentials in the script?
Below you can find the function, that needs to be modified.
function Copy-NetworkFoldersToC {
$sourcePath = '\\XYZ\ProfileCleaner\CopyToCdrive\*' #In here are the files and folder to copy
$destinationPath = 'C:\'
if (Test-Path -Path $sourcePath -PathType Container) {
Copy-Item -Path $sourcePath -Destination $destinationPath -Recurse -Force
}
}
Folders to copy go to ProgramData and Users\Public