I have a bunch of computers running Windows 8,1 connected by LAN to one central server that runs Server 2012 R2. I have all my scripts stored on the server, so to be able to run them from the other machines I added the scripts folder as a network location to the other machines.

My problem is that after every reboot trying to run a script (with PowerShell) that is stored on the server does not work, and I have to manually enter the mapped network location from File explorer, enter the credentials again and only then it works.

Every time I do that I check "Remember username and password", and yet I have to do it again after the next reboot.

Hope I was clear :) Any ideas? Thanks!

  • As a temporary fix whilst you work on a proper solution, create a user with privileges to the share, and map using a local script "net use x: \\server\share /user:domain\user password - This method stores the password in a totally unsecure format. – JohnnyVegas Aug 3 '14 at 9:02
  • 1
    add the credentials to the password manager in Windows: tech-recipes.com/rx/31797/… – magicandre1981 Aug 3 '14 at 14:14
  • Is the issue that the credentials are those of a different user or domain on the server (vs local machine)? – Watki02 Jun 11 '15 at 12:18

Have you tried mapping a drive in file explorer?

Assuming the issue is with needing a different user's credentials to access the server's mapped location, try this: (This is more of a work-around than a solution, and exploiting a bug rather than a feature, but see below)

  1. In Windows, add the remote network share as a mapped drive
  2. When in the map network drive window, check Reconnect at sign-in and Connect using different credentials enter image description here
  3. Enter appropriate server information and drive letter
  4. It will prompt you for credentials - enter the other (server) account credentials and check remember my credentials
  5. It should fail to connect since it is not the credentials of your local account, but let it fail and cancel out.
  6. Reboot your machine, (letting your script to add the network drive run)

If I explained this right, it will look like a normal mapped drive in file explorer, but be using the credentials of the other account when accessed in file explorer. Try your script now.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.