ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Windows service connect to NAS ?

    IT Discussion
    4
    19
    1.9k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • scottalanmillerS
      scottalanmiller @Dashrender
      last edited by

      @Dashrender said:

      I have a software package that runs as a service. I want this service to connect to a NAS for it's storage, but the service is only configurable to use a drive letter mapping, not a UNC.

      Map the drive?

      1 Reply Last reply Reply Quote 0
      • scottalanmillerS
        scottalanmiller @Dashrender
        last edited by

        @Dashrender said:

        When I'm logged into the server, and map the NAS to said drive letter, the service works fine, but as soon as I log out (or when the server reboots) the drive mapping is no longer there and the service fails.

        That's a problem with your mapping 🙂 Just have to fix that.

        1 Reply Last reply Reply Quote 0
        • coliverC
          coliver
          last edited by

          From http://stackoverflow.com/questions/182750/map-a-network-drive-to-be-used-by-a-service

          For this hack you will need SysinternalsSuite by Mark Russinovich:

          Step one: Open an elevated cmd.exe prompt (Run as administrator)

          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. The -i is needed because drive mappings need to interact with the user

          Step Three: Create the persistent mapped drive as the SYSTEM account with the following command net use z: \servername\sharedfolder /persistent:yes
          It's that easy!

          WARNING: You can only remove this mapping the same way you created it, from the SYSTEM account. If you need to remove it, follow steps 1 and 2 but change the command on step 3 to net use z: /delete.

          1 Reply Last reply Reply Quote 0
          • scottalanmillerS
            scottalanmiller
            last edited by scottalanmiller

            I think that this does it...

            net use /p:yes
            net use r: \\servername\sharename
            

            Edit: Found this as the official response from a Microsoft engineer too, after I had posted this...

            http://answers.microsoft.com/en-us/windows/forum/windows_7-networking/mapped-drives-disappear-after-logoff-or-reboot/f0d804c4-0a9c-46ab-ae52-162293e7011b

            DashrenderD 1 Reply Last reply Reply Quote 0
            • coliverC
              coliver
              last edited by

              Alternatively can't you just mount it via an admin console persistently? Shouldn't that carry over to other users?

              1 Reply Last reply Reply Quote 0
              • DashrenderD
                Dashrender
                last edited by

                How does the service map the drive?

                It's been a little while since I tried this in the past, but I recall creating a dedicated account for the service, logging in locally to the server as that user, mapping the drive, then logging out, logging in as myself and trying it, and it didn't work.

                ? 1 Reply Last reply Reply Quote 0
                • scottalanmillerS
                  scottalanmiller
                  last edited by

                  If we resolve this, we should provide feedback here too....

                  http://community.spiceworks.com/topic/303276-mapping-drives-at-server-startup

                  scottalanmillerS 1 Reply Last reply Reply Quote 0
                  • ?
                    A Former User @Dashrender
                    last edited by

                    @Dashrender said:

                    How does the service map the drive?

                    It's been a little while since I tried this in the past, but I recall creating a dedicated account for the service, logging in locally to the server as that user, mapping the drive, then logging out, logging in as myself and trying it, and it didn't work.

                    If you mean a services needs to access the shares you need to change it from the default "system" account in services.msc to change the logon to an account that has permission.

                    1 Reply Last reply Reply Quote 0
                    • scottalanmillerS
                      scottalanmiller
                      last edited by

                      See my edit above, Microsoft says that the way that I said to do it should work.

                      1 Reply Last reply Reply Quote 0
                      • DashrenderD
                        Dashrender @scottalanmiller
                        last edited by

                        @scottalanmiller said:

                        I think that this does it...

                        net use /p:yes
                        net use r: \\servername\sharename
                        

                        Edit: Found this as the official response from a Microsoft engineer too, after I had posted this...

                        http://answers.microsoft.com/en-us/windows/forum/windows_7-networking/mapped-drives-disappear-after-logoff-or-reboot/f0d804c4-0a9c-46ab-ae52-162293e7011b

                        Thanks I'll give that a try.

                        1 Reply Last reply Reply Quote 0
                        • scottalanmillerS
                          scottalanmiller @scottalanmiller
                          last edited by

                          @scottalanmiller said:

                          If we resolve this, we should provide feedback here too....

                          http://community.spiceworks.com/topic/303276-mapping-drives-at-server-startup

                          Nevermind, I posted the answer there and two moderators nuked the answer within minutes. Apparently answering old threads is not allowed now, which seems bizarre, that they want to keep the threads around as an archive but don't want updated information or just answers at all to appear on them.

                          So, I guess, the only method of assisting those people now is to answer here and PM them a link since you can't tell them the answer in SW.

                          No idea what the moderation planning is behind that, but as it was multiple senior mods in minutes, it must be a policy that people want over there. Up to them, no skin off my back. But it means that the Google search value of threads there will plummet since things can't get updated. There has always been a strange hatred of helping people after a certain number of months has passed over there, when I used to be a mod I noticed that after three weeks people considered a thread a waste and would never respond to it. Must be a cultural thing.

                          ? 1 Reply Last reply Reply Quote 0
                          • ?
                            A Former User @scottalanmiller
                            last edited by

                            @scottalanmiller said:

                            @scottalanmiller said:

                            If we resolve this, we should provide feedback here too....

                            http://community.spiceworks.com/topic/303276-mapping-drives-at-server-startup

                            Nevermind, I posted the answer there and two moderators nuked the answer within minutes. Apparently answering old threads is not allowed now, which seems bizarre, that they want to keep the threads around as an archive but don't want updated information or just answers at all to appear on them.

                            So, I guess, the only method of assisting those people now is to answer here and PM them a link since you can't tell them the answer in SW.

                            No idea what the moderation planning is behind that, but as it was multiple senior mods in minutes, it must be a policy that people want over there. Up to them, no skin off my back. But it means that the Google search value of threads there will plummet since things can't get updated. There has always been a strange hatred of helping people after a certain number of months has passed over there, when I used to be a mod I noticed that after three weeks people considered a thread a waste and would never respond to it. Must be a cultural thing.

                            Moderation there makes no sense now. Heck you can't even comment much on SAN topics without it being deleted. I think it hurts their ad revenue. I deleted my account there not worth the time when they just moderate crazy. Odd thing is incorrect/stupid answers never get nuked.

                            1 Reply Last reply Reply Quote 0
                            • DashrenderD
                              Dashrender
                              last edited by

                              I don't go there any more to help answer questions - only to ask them.

                              The larger number of people just gets that many more eyes on my issue - so I post it in both places.

                              1 Reply Last reply Reply Quote 0
                              • ?
                                A Former User
                                last edited by

                                I would except I've only really had one question answered well there aside from me researching it more and figuring it out myself. And that one was from Scott and Rob Dunn back when I was replacing and fixing the corrupt Domain at the county.

                                1 Reply Last reply Reply Quote 1
                                • scottalanmillerS
                                  scottalanmiller
                                  last edited by

                                  I sent a note to the powers that be and got a nice response. Post has been unmoderated and I'm not crazy after all 🙂

                                  DashrenderD 1 Reply Last reply Reply Quote 0
                                  • DashrenderD
                                    Dashrender @scottalanmiller
                                    last edited by

                                    @scottalanmiller said:

                                    I sent a note to the powers that be and got a nice response. Post has been unmoderated and I'm not crazy after all 🙂

                                    Was someone just 'piss'n' on you?

                                    scottalanmillerS 1 Reply Last reply Reply Quote 0
                                    • scottalanmillerS
                                      scottalanmiller @Dashrender
                                      last edited by

                                      @Dashrender said:

                                      @scottalanmiller said:

                                      I sent a note to the powers that be and got a nice response. Post has been unmoderated and I'm not crazy after all 🙂

                                      Was someone just 'piss'n' on you?

                                      It was multiple people, and people that I would not expect that from, so I think it was a misunderstanding of moderation rules or goals. They both picked the same reason too, so it wasn't like they weren't thinking the same thing.

                                      1 Reply Last reply Reply Quote 0
                                      • ?
                                        A Former User
                                        last edited by

                                        I think pruning down the number of moderators, especially volunteer ones would help.

                                        1 Reply Last reply Reply Quote 0
                                        • 1 / 1
                                        • First post
                                          Last post