lothos12345 Posted November 9, 2005 Posted November 9, 2005 We have an server that when it is restarted it looses its share. I need to write a service in Visual Basic.NET that will start when the server starts, look at those folders, and if the folders are not shared, share them. I have never written a service or changed the share of a folder from inside code. Any code examples or recommendations would be greatly appreiciated. Quote
Administrators PlausiblyDamp Posted November 9, 2005 Administrators Posted November 9, 2005 A service seems a bit of overkill for such a simple task - what OS is the server running and is it part of a windows domain? If so you could do this easily through a group policy and a startup script. If not you could use a MS utility called srvany.exe and a batch file to acheive the same result. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
lothos12345 Posted November 9, 2005 Author Posted November 9, 2005 It is Windows Server 2003 Enterprise Edition and my manager wants a service, though I do agree with you its not my call. Quote
Administrators PlausiblyDamp Posted November 9, 2005 Administrators Posted November 9, 2005 Odd choice, normally a service would be running constantly in the background, in this case it would effectively run once and then not really sure what it would be expected to do :confused: Does your manager actually have a reason for wanting a service? Try this instead, start -> run and enter mmc File -> Add remove snap-in -> add -> select Group Policy Object Editor and click Add, Finish, Close and then OK. Expand Local Computer Policy, Computer Configuration, Windows Settings and select scripts. On the right double click startup and then select Add... then Browse... In the window that appears right click and create a new text file and rename to something useful like mapdrive.cmd and open it in your editor of choice and in it enter something like NET USE \\\ then save and exit that and keep accepting, okaying etc. till everything is done. If you are not overly familiar with the NET USE command then drop to a command prompt and just type NET USE /? for a bit more help (like specifying a user / password when mapping) Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
TheWizardofInt Posted November 10, 2005 Posted November 10, 2005 I worked for a guy like that once He didn't know what it was he really wanted, so once I knew that I created it and told him that that was it. If your boss 'wants a service' and you don't think he has the brain wattage to check services but, instead, wants a program that will start whenever the PC starts, then write your program and make the appropriate registry entry for Hkey_Local Machine Quote Read the Fovean Chronicles Because you just can't spend your whole day programming!
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.