Turn off password protected sharing in command line RRS feed

  • Question

  • Hi,

    I was able to turn off password protected sharing in Control Panel\Network and Internet\Network and Sharing Center\Advanced sharing settings, but I want to use a batch file or script file to reach it automatically when system installing. Does anyone know how to do it by which command or registry?



    Monday, August 13, 2012 7:20 AM

All replies

  • I would try taking a look at the WMI Win32_Share class. I would expect that putting the right options in the security descriptor would do it, although I'm not sure what exactly needs set.

    I recommend using GetShareInfo before and after changing the option manually to see what changes in the security descriptor, and that should help you figure out what you need to change.

    wmic is the command-line tool for performing WMI queries.

    Update: From what I've seen, access to advanced sharing is technically a per-user/per-share option, even though it looks like a global option in the CP, which is why the Win32_Share class seems promising. For a somewhat related example, see this thread: http://social.msdn.microsoft.com/Forums/en-SG/netfxbcl/thread/2e06861c-8ac9-498c-8cc9-712aacb3eb6c

    They are just turning advanced sharing on and off, not changing the password setting, but they do it on an individual share.

    Tuesday, August 14, 2012 1:25 PM
  • I nuked a whole pile of services, that seems to have stomped on sharing in the way.

    (the firewall now only allows icmp, dns, http(s) and rdp)

    looking at the list, it appears I did "sc config XXXX start= disable" for:

    • client for nfs (why is it even there?)
    • computer browser
    • ip helper (no faux ipv6 here)
    • lpd service 
    • Microsoft .NET la de da (why do they even exist?)
    • print spooler
    • rip listener (v1 only? what's the point?)
    • server
    • tcp/ip netbios helper

    One or the other of these seems to have killed off sharing.


    Friday, August 31, 2012 1:42 AM