![mac network drive does not unmount mac network drive does not unmount](https://cdrhdev.unl.edu/log/wp-content/uploads/2015/06/4_careful_selection.png)
To get it working after a reboot, create a script just containing net use z: \servername\sharedfolder and set it to run on computer startup, per /en-us/library/cc770556.aspx This will run as the SYSTEM account, so no need for psexec. That's how you can tell this hack is not supported by M$. It may claim to be disconnected but it will work for everyone. NOTE: The newly created mapped drive will now appear for ALL users of this system but they will see it displayed as "Disconnected Network Drive (Z:)". If you need to remove it, follow steps 1 and 2 but change the command on step 3 to: "net use z: /delete" WARNING: You can only remove this mapping the same way you created it, from the SYSTEM account. Step Three: Create the persistent mapped drive as the SYSTEM account with the following command "net use z: \servername\sharedfolder /persistent:yes" The -i is needed because drive mappings need to interact with the user Step two: Elevate again to root using PSExec.exe: Navigate to the folder containing SysinternalsSuite and execute the following command "psexec -i -s cmd.exe" you are now inside of a prompt that is "nt authority\system" and you can prove this by typing "whoami". Step one: Open an elevated cmd.exe prompt (Run as administrator) It's a hack, so use at your own risk and all:įor this hack you will need SysinternalsSuite by Mark Russinovich: I'd suggest that the easier, and more supportable solution to your problem would be to do the same, and have the drive mapped for that service account user by Group Policy or logon script.Īnyway, should you be determined to try this without a user context, see the below.
#Mac network drive does not unmount code
In situations like this where some crappy piece of code needs a user logged on to run (like Domino server, grumble) I've created a service account that's to always be logged in on a given server, and setup an auto-login script, so that the machine logs in the specified account on reboot automatically. This apparently possible, according to this StackOverflow post.īefore posting the content of the answer, however, can I suggest that you're over-complicating this?