Question : net share system error 5 acces denied


I want to create a net share via command shell. Easy to do I thought:

net share d=D:\ /GRANT:USER,FULL

However I am getting a system error 5, access denied. Since the user I am running the script from has administrative rights I am somehow stuck. Any ideas?

Computer is running windows 7 home premium. Creation of the share through windows (not command shell) works fine, but since the device is mounted and unmounted regularly I want to automate the creation of the share. Any ideas?

Best regard and appreciation in advance.

Answer : net share system error 5 acces denied

You CANNOT escalate your privileges without asking user for permission (I guess you will not use singed exe file with manifest data). So you have to ask user. One way is run your batch file as admin (via right click). Another way is escalating privileges with UAC prompt visible,

It's relatively easy to do with vbscript. You can find some details here:
Random Solutions  
programming4us programming4us