Windows service connect to NAS ?
-
@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?
-
@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.
-
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.
-
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...
-
Alternatively can't you just mount it via an admin console persistently? Shouldn't that carry over to other users?
-
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 we resolve this, we should provide feedback here too....
http://community.spiceworks.com/topic/303276-mapping-drives-at-server-startup
-
@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.
-
See my edit above, Microsoft says that the way that I said to do it should work.
-
@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...
Thanks I'll give that a try.
-
@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.
-
@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.
-
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.
-
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.
-
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
-
@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?
-
@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.
-
I think pruning down the number of moderators, especially volunteer ones would help.