Login into remote drive


I have a script for backing up a directory to a remote PC, and it works great if I enter the login info manually. How would I have Power Shell send a login to access the remote PC ? Any help would be greatly apricated.


A much better option would be to grant access to the target folder to the account your script runs with. This way you don’t need to handle rights or accounts in your script. :wink:

I would, but I don’t want the host PC having full time access to the remote PC storage. I want the back up to run, then disconnect. If somebody tries to access the backup directly I want them to have to login.

?? What??

If somebody tries to access the backup directly they would need to have the account you use to run your backup. And of course you would grant access only to the particular backup location on the target PC. IMHO that’s actually more secure than storing the needeed account / credentials to be used by your script. And it is less error prone.

OK, I just re-read your original post. I was doing the backups from the main account on the PC. I believe you’re saying create a 2nd account just for the backups, and then give only that account access to the remote PC. Correct ?

Yes. This account only need read access to the source files and write access to the backup location. Grant as less access as passoible but as much as needed.