I am writing a script that will copy a file to a folder on my local C: drive. The folder requires an Admin to write to. I cannot run the script from the ISE or using alternate credentials. So I need to prompt for credentials in the script. Copy-Item will not accept a credential. I have searched all over the internet and it seems the accepted method is to create a new PSDrive with your credentials and then copy the file. Unfortunately, I have not been able to get that to work either. I can create the drive, but I still get “Access Denied” when I try to copy the file.
Any help would be greatly appreciated.