Question : net share system error 5 acces denied

Hi.

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: http://blogs.technet.com/b/heyscriptingguy/archive/2006/04/28/how-can-i-use-the-runas-command-to-run-a-script-under-alternate-user-credentials.aspx
Random Solutions  
 
programming4us programming4us