How do I turn Password Protected Sharing on or off programmatically?

后端 未结 6 718
梦毁少年i
梦毁少年i 2020-12-29 16:24

Windows Vista and 7 has this switch in Network and Sharing Center. It\'s on by default, and that prevents unauthenticated access to shares even if they\'re shared with Every

6条回答
  •  梦谈多话
    2020-12-29 16:41

    Probably too late :) , but hopefully useful for others.

    The following steps worked just fine for me (it worked on W8 consumer preview too).

    to turn it off:

    1 - Enable guest account by running

    net user guest /active:yes

    2 - Obtain guest user SID by running, for example,

    wmic useraccount where name='guest' get sid

    3 - Obtain write access to registry folder HKLM\SECURITY

    4 - Modify the following key, where $SID is the sid obtained in point 2, to:

    [HKEY_LOCAL_MACHINE\SECURITY\Policy\Accounts\$SID\ActSysAc]
    @=hex(0):41,00,00,00

    5 - restart the machine (until now, I didn't find a better way to make the change effective)

    to turn it on again:

    [HKEY_LOCAL_MACHINE\SECURITY\Policy\Accounts\$SID\ActSysAc]
    @=hex(0):c1,00,00,00

    then restart

提交回复
热议问题