Sync folders to network shares?

I set myself up a windows server, running AD, print services, filesharing, network installation stuff, and what not. I got bored really, but I figure I may as well make use of it, since I don't know what else to do with a dual P3 system. actually, to be honest, the whole reason I got the dual P3 was so i could get some hands on experience with server 2008
anyhow, after much trial and error, I managed to get some shares mounted in fstab via cifs, one of which, is a backup folder for myself.
basically, what i want, is to have my home folder on this machine synced to the one on the server. I tried devicesync, which works....which was a bad idea because as it turns out, it wants to replace everything everytime, so its not really a viable option.
so I'm looking for something that can sync my data to the server, pretty much the way that it is, so that i can access it across my network in the same manor of organized chaos that I do locally. I figure a weekly cron job will come into play, but right now I just need something that can do the incremental changes, adding new files and modified files.
I'm hoping that if i can get this setup the way I want, rather than scattering stuff across multiple machines, I may be able to keep stuff on the main linux machine I use, and as long as things stay synched with the network folder on the server, I might just be able to quit scattering stuff across so many machines, and just have everything on the main machine, and then the network backup that i can access from any machine, since I'm running AD, and managed to get some login scripts to map my folders
any suggestions?
Last edited by ssl6 (2009-12-23 05:00:08)

thats a start, I'm sure it should do the job.
but I'm looking at the examples on the site, and it seems they have splitting files by the day of the backup. I'm safe to assume thats not necessary?
just started looking at the wiki page, should have thought to check for that first.
it should do the trick, if i can figure it out, I thought I was a tech guy.....until I went linux....windows I can do in my sleep...but some of the linux stuff, man........at the same time though, rsync looks like a much simpler and straight to the point than anything i've found for my windows clients, i hate the windows backup for splitting files into folders in all sorts of wierd ways, and I really don't consider offline files an option for backup, I don't know why that would ever be suggested, at least for my scenario....
anyhow, Thanks a lot for the speedy reply, I'll post back with results, or if I need another suggestion, but I'm 99% positive rsync is what I'm looking for
just thought i'd note, I'm actually quite impressed by that specific wiki page, props to whoever wrote it, for breaking down the commands and explaining the switches, saves me doing rsync --help to get that info, jsut a nice touch I feel I sometimes don't see often enough
Last edited by ssl6 (2009-12-23 05:23:27)

Similar Messages

  • JTree Explore System Drives,Folders and Network Share

    Hi all,
    I need to list all the drives,folders and Network Share if any using JTree in a combobox similar to windows explorer.Please help me
    Sathya

    this will help you a little:
    File f [] = File.listRoots (): returns all the drives: the local && Remote ones
    to list directories & files you do something similar: File f2 = f[0].listFiles ();
    check on file/fir: f2[0].isDirecoty() or f2[0].isFile()
    Tip:
    You probably were planning on reading all files and directories and then showing them. If you did, DON'T. It will take forever! Just list the roots, if a root is selected list it's directories & files, if a directory is selected list it's subdirectories & files and so. Also try creating a DirectoryListener which is active when the directory's contents is visible and which will relist it's contents when it's contents is changed.
    enjoy, will be fun!
    greetz,
    Stijn

  • Can I sync to a network share or personal web server?

    Hello,
    I really love the idea of FireFox Sync.
    However I am very uncomfortable with storing that much personal information on a third party server, even one as trusted as yours.
    Is there a way to sync up to my own web server (running linux) or sync up to a network share (on windows)?
    Right now I'd be most interested in syncing the password file between my laptop and PC using a windows network share, and not having that sensitive data travel over the internet at all.
    I know it is encrypted and everything but security breaches and flaws do occasionally happen and as a business owner with everything stored in my password file I cannot take that risk.
    I have the staff available to write a addon to take advantage of this feature, if there is documentation available on how to leverage the sync code to connect to a different server or network share.
    Thanks!

    See this: <br />
    http://docs.services.mozilla.com/howtos/run-sync.html

  • Can't copy files to a network share but can copy folders...

    I frequently use a network share at work. I can view files off of it fine. I can erase files off it. I can copy folders to it.
    However, any time I copy any single file I get the following error.
    "The operation can’t be completed because you don’t have permission to access some of the items."
    This occurs for every file I've tried. From txt files to jpgs to docs. Everything gives that error and fails. I'm at a loss and it's totally killing my productivity.
    It's a linux based share and all permissions on that box are correct. My account can easily copy files from other machines. Also, the fact that files and modifications work on this computer seems to prove that as well. I think it's pretty apparent that the cause of this error is on my laptops end.
    I've verified my disk permissions. I have no clue what could be causing this.

    Look at this thread for discussion of this issue.
    http://discussions.apple.com/thread.jspa?threadID=2382501
    Search is your friend.

  • Network Shares, Mobile Clients, Kerberos and Single Sign On Woes

    Hi anybody,
    I'm sure there is a really simple answer to my network share problems but I just can't seem to get them to work. Does anybody understand OD/Kerberos/SSO?
    I am running 10.4.10 with DNS, AFP and OD.
    My DNS is correctly configured, I can resolve IP into name and back again on server and client machines and it's not using a .local domain.
    My OD is set up as a master with the correct LDAP search base settings, Netinfo is off for some reaseon but I can't turn it back on even if I wanted to. I have directory binding enabled as well as requiring clients to bind to directory.
    My AFP is set to enable Bonjour registration and Authentication is set to Kerberos.
    My client computers are able to access network accounts and my mobile clients are able to sync their home directories.
    All seams to be working exceptionally well except for access to the shared network folders.
    I am convinced that the network folder is set up correctly as I have RTFM many times and if I play with the acess settings such that anybody has read and write permisions, clients are able to access the data.
    However, I wan't to reach my networking Nirvana where I can control access to the network share depending on group id. This shouldn't be difficult but it does seem unatainable for me .....
    Having done a bit of trouble shooting and more reading, I can see that the clients are trying to access the share as an unauthenticated user ..... which is where it all goes wrong for me.
    I thought that Kerberos SSO would have sorted this out but I don't think the clients are even trying to authenticate with the server as thay use the local Netinfo database to log in.
    How do I get clients and mobile clients to do a Kerberised SSO at login?
    Anybody !
    Thanks in advance.

    bump?

  • Portable Homes / Mobile Homes and Network Shares

    So, i'm now using portable home and its working pretty well.  Gave up on using Profile manager to configure it and using WGM instead. 
    But, I also have a variety of network share points that I'd like to have available on the road, including when I don't have internet.  Right now, I can access them via VPN which works ok, but is there any way to sync share points just like my home folder?
    In my setup, I'd be the only user who has this level of access to the share points---i woudn't set up any other users to be able to sync them. 
    Doable?
    I currently use dropbox, but dropbox really isn't secure enough for my business (healthcare), and I can't really use dropbox to sync network shares
    I've looked at Owncloud, but it looks like the only way that Owncloud will sync network shares is if I give read/write access to those folders to the _www user, and I don't fully appreciate the security implications of that and would like to avoid it.
    Anyone got a better idea for making the contents of several network shares (on an OSX server) synchronize to my laptop (which is bound to the server and has a mobile home) for on and offline use?

    Aren't you going to run into update conflicts when someone back at the office updates files you also update when offline?
    Perhaps a cellular data plan would solve your problem?

  • Backing up network shares

    The school I work for uses a large number of Network Home Directories for Students. Our 350 students share approximately 150 MacBook Airs and iMacs, with each student using a network account to log in.  I've load-balanced the student accounts across 4 Mac Mini servers acting as file shares (with twin 256gb SSD) and 1 aging 2009 Xserve.  In years past, the student home directories were hosted on RAID volumes, providing data redundancy in case of a drive failure. With the Minis, however, this is not the case. Each mini has 2x256gb SSD drives: one drive is reserved for OS/Apps/Server Data and the second drive will be used exclusively to handle student home directories.
    I have a fifth mac mini with a 4TB Pegasus Thunderbolt RAID 5 that I would like to use as a backup server for these Home Directories. I'd like to use some combination of rsync/automator/ical to schedule these backups to happen nightly (like, between 10:00pm and 5:00am).
    I was thinking that:
    BackUpMini would need to mount the network shares of each of the 5 file servers:
         /XServe5/Home Directories/students a-g
         /Mini1/Home Directories/students h-l
         /Mini2/Home Directories/students m-o
         /Mini3/Home Directories/students p-s
         /Mini4/Home Directories/students t-z
    BackUpMini would have the RAID mounted with a volume called "Home Directories Backup" with unique directories
         students a-g
         students h-l
         students m-o
         students p-s
         students t-z
    An rsync script would copy each source folder to its corresponding target volume on the RAID.
    Does the logic seem sound?
    If so, does anyone have any advice on what a script should look like to handle this all in one shot?
    Thanks for any feedback,
    Christopher

    So a few thoughts that may help you down the right path.
    First, if you are equally distributing your 350 students across the 5 servers as seen here:
         /XServe5/Home Directories/students a-g
         /Mini1/Home Directories/students h-l
         /Mini2/Home Directories/students m-o
         /Mini3/Home Directories/students p-s
         /Mini4/Home Directories/students t-z
    We can assume a normalization of there being 70 home folders per server.  (Obviously, the number of students in the T-Z is likely less, but we will stick with the averages).  If this is the case, you might be running a real tight ship when considering that a 256 GB disk will provide an average of only 3.65 GB per student home folder.  Not knowing the age or the work content, this could be very tight and may result in some issues, especially if you are not redirecting cache and temp files.  Consider that each home folder, without user template modification is 8.3 MB before logging in.  Once logged in, the home folder can triple without launching a single app.
    Again, you have the experience so I trust you ran the numbers.  I know however that I would be very concerned about a volume so small.
    So now to your question.  Yes, rsync can do this very effectively.  The 3.1.1 release has been very good.  Add the creation times and extended attribute patches when you compile. 
    And, assuming that you are looking to do a nightly sync, then your strategy makes sense.  Plus, you should not be concerned about bandwidth.  After all, the rsync will occur in the evening when no one is using the network.  The rsync should also push the data over ssh, not by mounting AFP/SMB shares.  Tunneled over ssh is faster, does not require the Finder to be active, and can easily be automated via cron or launchd.  Simply exchange your ssh key and your backup system will function fully automated. 
    Also, if all of the machines are integrated into the same domain, you can even push all permissions.  If you opt to do this, rsync should connect as the root user (must edit sshd.conf) so that you can traverse all the folders, avoiding permissions lockout.  In theory, if you do this right, you will be able to move the backup volume to the failed mini, remap the net home mount, and pick up right where you left off.
    And remember, the minis can be link aggregated to support more network bandwidth.  I remain a fan of the USB to 1000Base adaptors since it leaved the TB port open.  But Thunderbolt to 1000Base will work just as well.  Talk to your switch team to enable 802.3ad link aggregation on the switch and you can run the minis at 2000Base.  For the $40 cost of an adaptor, this extra speed is really a bonus.
    Oh, one other tip about rsync.  I've gotten into the habit of wrapping my rsync script into a conditional.  What I learned (the hard way) is that rsync does what you tell it and does not question.  This can be devastating...  So I've been doing my rsyncs like this and I sleep better at night:
    #!/bin/bash
    ## Base Variables
    # I define a date stamp with something like:  theDate=`date +%m_%d_%y_processName`
    # I will define a log path so I can change it easy:  baseLogPath=/Volumes/Backup/Library/Logs/
    ## Confirm that Source is Present
    ## Assuming I am triggering this from the backup server, I will first confirm that the source is visible.  If it is not, I run the risk of deleting all my content
    volumeSane=`ssh [email protected] "test -e /Volumes/Data/.rsyncTrigger && echo 1 || echo 0"`
    if [ $volumeSane = 1 ]; then
    # run the rsync only if the source volume is present
      (rsync -avX -e ssh "[email protected]:/Volumes/Data/SharedFolders/" "/Volumes/Backup/SharedFolders" --delete --stats >> ${baseLogPath}${theDate}.log) >& ${baseLogPath}${theDate}.error
    elif [ $volumeSane = 0 ]; then
    # don't run if the source is missing
    # I also like to do a osascript -e "display notification \"hey it failed\""
      echo "source volume not present -- exiting" >> ${baseLogPath}${theDate}.error
    fi
    Reid
    Apple Consultants Network
    Apple Professional Services
    Author "Mavericks Server – Foundation Services" :: Exclusively available in Apple's iBooks Store

  • How to get "fast user switching" and network shares playing nice

    I've been alternating between banging my head against a wall and reading every forum I could find to try and get a reasonable compromise between using "Fast user switching" and sharing a folder from a file server.  It baffles me how the network share/mount model of OSX/AFP is completely killed by fast-user-switching; this is a big problem with Apple requiring users to be actively logged in to share music/video from iTunes which therefore essentially requires fast-user-switching if anyone else wants to use the computer.  (anyone find it odd that you can share files without being logged in, but sharing songs requires an active login for each user who is sharing?  Apple: time to make iTunes sharing a service!)
    For the sake of example, lets just say I want to share my /Groups folder from my desktop and have it be accessible to my laptop.  Here are all the things that I tried:
    Apple Method 1) Share /Groups in the Server.app on the desktop (running Lion Server), use finder on the laptop and drag the share icon to "Login Items", alternative use a startup Apple script using "mount volume"  Both of the options work and will mount the /Groups folder under /Volumes/Groups, of course when the second person logs in via fast-user-switching (and occasionally the first person for no apparent reason), they will get /Volumes/Groups-1 since /Volumes/Groups is already taken.  Tomorrow we log in a different order and now the previously /Volumes/Groups-1 user has their mount at /Volumes/Group and vice versa.  Any links, aliases, finder sidebar references, and application settings which pointed to yesterday's location are now BROKEN.  Not very user friendly to my mother-in-law who is trying to find those pictures of the kids and doesn't know anything about mount points. I also can't reasonably mirror the file location structure on the desktop so that application preferences that are synced between the two (portable home directories) work.   fail.
    Apple Method 2) Use automounter and set up by hand direct maps for /Groups or an indirect maps for the children of /Groups.  Now it will automatically get mounted to /network/servers/SERVER/Groups/ on the laptop and on the desktop it will automatically create a similar symlink structure so that the same path (/network/servers/SERVER/Groups) work both on desktop and laptop.  Cool.  Except when the second person logs in, the /network/servers/SERVER/Groups/ mountpoint is already owned by the first user and they don't have any permissions to access it.  Fail.
    Apple Method 3) Use mount_afs and specify directly the mount-points.  Have each user have their own startup AppleScript which mounts /Groups to a different location (e.g. /Users/Shared/username/Groups) that way they don't conflict with multiple users.  On the desktop, set up symlinks from /Users/Shared/username/Group to /Groups so that it will be the same as the client and applications settings will work when synchronized back/forth by portable-home-directories.  Will it work, yes it does, but what a bear to maintain.  Is this really what I should expect to do just to have multiple users on my desktop and laptop (which again is essentially required now if I want to do any type of iTunes sharing).  This can't be what apple expects.
    What I ended up doing - the "not quite apple" solution.
    Non-Apple Method 4) After a read of "Autofs: Automatically Mounting Network File Shares in Mac OS X" (http://images.apple.com/business/docs/Autofs.pdf) at the very end there is a single paragraph  of "Kerberized NFS": "A Kerberized NFS mount can have multiple connections from multiple users, each using the correct user’s credentials for each transaction. This allows administrators to support multiple users, each authenticated with their own credentials to the same mount point. This is very different from AFP and SMB mounts," (emphasis mine)
    It appears that by using good 'ole NFS (abeint with Kerberos for security!) you can actually have multiple users on the same mount point.  Roughly following the guidance at https://support.apple.com/kb/TA24986?viewlocale=en_US.  What I needed to do was:
    1) create /etc/exports on my desktop and add a single line "/Groups -sec=krb5".  The existence of /etc/exports triggered a start of nfsd which no longer has any GUI options in Lion.
    2) Add a line to /etc/auto_master on my laptop "/-  auto_mymounts" to reference a new direct map.
    3) Create /etc/auto_mymounts and add a single line "/Groups         SERVER:/Groups" to create the direct map.
    THAT'S IT.  Three lines in three files.
    Now when I log into my laptop, there is a /Groups that is a network mount of my desktop's /Groups, same location AND it works for all of my users, even simultaneously. 
    In the end I'm happy with what I've got, but man was this a difficult path just to support fast-user-switching.  In Lion, Apple appears to be getting away from NFS (no longer turned on by default and remove from the GUI controls) but clearly this really useful functionality which doesn't exist in AFP. 
    I'm really curious, after all this work.  Any other ways to accomplish this?

    In my example above, yes I chose to mount the share "Groups" to the top of the root since that is where I put it on my server and I wanted to keep them similar; but that was just my preference, it isn't a requirement.  You can export and mount from other directories.

  • How do I merge multiple instances of the same network share?

    In my (large) Lightroom 5.2 (Windows) library I have three instances of, essentially, the same network share (a Drobo NAS) which appear separately in the library.
    One appears as Share (\\nas) L:, one as \\nas\Share and one as \\nas\share. The contents of the share are spread randomly across the three - so one might contain the folders series\event1, series\event4 and series\event5 and another series\event2, series\event3 and series\event6.
    Is there an easy way to convince Lightroom that they're all the same physical location and merge them in the library? No amount of dragging, dropping, importing or synchronization seems to have had any effect so far!
    Guy

    Bizarre. It turned out I could merge them, but only in to the mapped drive - L: - and only by explicitly clicking on the drive icon - if I typed L:\series in to dialog box it converted it back to \\nas\share\series... Not helpful.

  • How do i add a network share to the library without copying everything

    i have a windows machine at my house that is set up as a media server with locally shared folders. my old ibook g4 simply doesn't have the space to store all of the media i have. i mounted the shared folder using samba but every time i open a song or a movie itunes needs to copy everything onto the local computer before playing it. i need someway to tell itunes to open the files off of the share and stop filling up my hard-drive by copying everything to the local itunes folder. all i want is a way to add the mounted volume to the library while keeping the files on the network share.

    Never mind, I figured it out.
    Thanks!
    Simply Command+K and add the SMB shares accordingly using the SMB:// prefix.

  • Unable to save MS Word and Excel 2010 and 2013 onto the network share

    Hi,
    I have read similar cases, but did not work out on the problems we face.
    We are using Office 2010 and Windows 7 and it seems like only this combination will encounter saving problem on the networe share (but local / removable disks are fine) - 
    Other combinations:
    Windows XP and Office 2010 - no problem
    Windows XP and Office 2003 - no problem
    Windows 7 and Office 2003 - no problem
    In Microsoft Word 2010, when saving a new document, it will save but create a 0KB file in the network share drive and I notice the blue menu bar of the Microsoft Word 2010 still displays "Document1" instead the new file name.
    And only when I click save icon or exit button, Word actually prompts another "Save As" dialog to save the file, and as a result, I have to save the same file and answer MS Word prompt to replace the existing file - and this is the real time that
    the document and its contents really got saved. And the blue menu bar then displays the actual file name.
    In Microsoft Excel 2010 (also Powerpoint I suppose so), in saving a new excel file, after typing in a file name for the new file in the network share location, it will prompt a dialog box indicating the "File is currently in use"
    Similar to MS Word, it will still create a 0KB file in the network share, and only a second time saving and replace the 0KB file, is able to save the file again. 
    I have tried a lot of ways from Safe Mode, Disable Add-in, Added Trusted Locations to the network share in MS Word and Excel, Uninstall Antivirus software, redo NTFS permission on the network share server folder, etc but the problem cannot
    be solved.
    Any help is appreciated. Thank you in advance.
    Kind regards,
    Daryl

    Thank you Max.
    I have tried various storage configurations and share the folders out in Windows Servers and grant user accesses with AD.
    These drives configuration involves iSCSI drives, using NAS drive, using internal SAS RAID drives in Windows 2008 servers, all having the same errors, but the latter one was having the most errors almost every first time the users
    save their files (includes saving from email attachments), the files will get 0KB.
    I have tested LAN cables, switch LAN points in panels and switches, and comes to no avail.
    I have patched with the latest office updates (the latest being Office 2010 SP2) also to no avail.

  • Mounting a network share via Applescript or Automator causes errors in MS Office apps

    If I connect a network share using an automated process, either using Applescript or Automator, though the share shows up on the Desktop and I can open it and view the various folders and files, MS Office apps including Powerpoint, Excel and Word are unable to open the files.   Each gives a slightly different error message.  In Excel, it looks like this:
    In Word, it's:
    In Powerpoint, it's:
    BUT, if I connect to the server share manually (using Cmnd-K in Finder), all files and folders are properly accessible.  I cannot see any differences between the shares connected by the two different means on the Desktop.  They have the same name, are the same size, etc.; in short, everything about them seems identical.  I even took screen shots of the Get Info page from one of them connected by the different methods:
    "home" connected by Automator:
    and connected manually:
    Does anyone have any ideas as to why this is happening or how to fix it?

    I had the same issue. After upgrading kernel to 3.4.5 today the cifs share mounted with original fstab settings. I believe it was caused by this bug:
    kernel changelog wrote:    The double delimiter check that allows a comma in the password parsing code is
        unconditional. We set "tmp_end" to the end of the string and we continue to
        check for double delimiter. In the case where the password doesn't contain a
        comma we end up setting tmp_end to NULL and eventually setting "options" to
        "end". This results in the premature termination of the options string and hence
        the values of UNCip and UNC are being set to NULL. This results in mount failure
        with "Connecting to DFS root not implemented yet" error.

  • Issues Opening Files in Network Share

    Hello,
    I'm hoping someone can help me with this issue I'm having,
    I use a Windows 7 desktop at my office and I have a Network Share on a Windows 2008 Server where I save all my documents and file I work on each day.
    I use my Macbook Air when I'm working at my other office and when I'm traveling.
    My issue is this,
    I setup and able to connect to my Network Share and see all my folders and files. Although if I try to open a file it tells me it can't find the file even though I used Finder to browse right to the file and double clicked on the file. I can copy the file locally to my MacBook, work on the file and then copy it back to the Network Share.
    From me testing different things this is what I have found,
    It's only Word, Excel and Powerpoint documents that don't open from the Network Share. - I do have Microsoft Office 2011 Mac installed
    TXT & PDF Files open just fine from the Network Share.
    I doesn't matter if it's Word, Excel or Powerpoint files created on my Windows 7 desktop or my Macbook Air, once it's moved to Network Share I can't open it.
    This is where it gets really confusing, other Network Shares I can open the Excel & Word files right from the Network Share, it's just my personal Network Share and I put in the right username and password for my Network Share since I can open the TXT & PDF files just fine.
    I'd appricate any help with this issue.
    Thanks in advanced - Jonathan

    I have the same problem and i'm not the only one @ my office. seems that everybody who uses mac in our office has the same problem. So could anybody give any advice how to solve this problem? Do we need to configure shared folders on server or just our macs?

  • User file usage on network shares

    I need to create a PowerShell script where I can show how much storage space users are using.  This would be for users on multiple network shares, above a certain amount (5 GB for example) and then exported to a CSV.  Is
    it possible to show the first level of subfolders and their totals? 
    Our Helpdesk does not have the permissions to see the folders on the shares but I do (Domain Admin).  I will run the script every so often and email the CSV to them so they can contact the users.
    Thanks!
    J

    Hi,
    Yes, that's possible. Here's some starting material for you:
    http://blogs.technet.com/b/heyscriptingguy/archive/2012/05/25/getting-directory-sizes-in-powershell.aspx
    http://blogs.technet.com/b/heyscriptingguy/archive/2013/08/03/weekend-scripter-use-powershell-to-get-folder-sizes.aspx
    Let us know if you have any specific questions.
    Don't retire TechNet! -
    (Don't give up yet - 13,225+ strong and growing)

  • SQL server can't access network share

    Hello,
    I am facing an issue where the SQL server can't access the network share. The network share is mounted by  a domain user who is also configured as Administrator on the server.
    Through SQL Server management studio as well as PoweShell script when i try to access the share in order to attach the database contained within the share, i get the error "Unable to find the file specified". I can't mention the network drive to
    the SQL management GUI file browser too if i try to attach the database through GUI.
    For all SQL services, I changed the service log on account to be the same account which mounts the network share.
    As work around - 
    I launched a command prompt under NT Authority \ SYSTEM (LocalSystem) account and mounted the drive to the same location which lead to adding one more connection but under local system account. With this change, the SQL server was able to access the network
    share!
    I couldn't understand whey SQL expects the network share to be mounted under local system account even if all the SQL services are running under domain account ? I want SQL to be able to access the network share without opting for above work around.

    Hello,
    I couldn't understand whey SQL expects the network share to be mounted under local system account even if all the SQL services are running under domain account ? I want SQL to be able to access the network share without opting for above work around.
    It doesn't have to be. The workaround is only a temporary fix and is certainly not a good idea. I would not use mounted folders with SQL Server, at all, period.
    The reason you're having difficulty is that when the folder is mounted, it's mounted for YOUR session not ALL sessions. SQL Server has already started its services and is running under its' own session and is not privy to the things you do to change the
    environment. For example, if you changed a system or user variable (for example, a SET variable) SQL Server would have no idea about this because when it started, that variable either didn't exist or was something else. This is not SQL Server's fault but how
    Windows works (this information is stored in the Process Environment Block [PEB]) for any windows process.
    As other's have said, don't use mounted drives - use a UNC path. UNC paths are 100% supported on 2012+ as well as running databases on a SMB 3.x share (UNC pathed of course).
    If you absolutely must use a mounted drive, enabled xp_cmdshell access (through sp_configure) and run the net use command through xp_cmdshell. I, once again, would highly advise not doing this and using an UNC path.
    -Sean
    The views, opinions, and posts do not reflect those of my company and are solely my own. No warranty, service, or results are expressed or implied.

Maybe you are looking for