如何在 Windows 7 中以编程方式打开/关闭密码保护共享?
让我提前道歉。我已经在这里看到这个问题了,但还没有完全回答。 (如何打开或关闭密码保护共享以编程方式关闭?)。我不知道如何在不提出新问题的情况下再次解决问题。如果我应该做一些不同的事情,请告诉我,这样我就不会犯两次同样的错误。
我们使用 C# 编辑网络设置,并向 Windows 7 添加 2 条防火墙规则,以用于需要 Windows XP 样式共享的旧应用程序。除了如何“关闭密码保护共享”之外,我们已经弄清楚了一切。如果有人解决了这个问题,请告诉我。
我已经导出了调整设置之前和之后的整个注册表。使用Beyond Compare来定位任何差异,但没有发现任何有用的东西。任何和所有的想法都会受到赞赏。
Let me apologize ahead of time. I saw this question on here already, but it has not been answered completely. (How do I turn Password Protected Sharing on or off programmatically?). I couldn't figure out how to have a question addressed again, without simply asking a new question. If I should have done something different please let me know so I don't make the same mistake twice.
We are using C# to edit network settings and add 2 firewall rules to Windows 7 for a legacy application that needs Windows XP style shares. We have figured out everything except how to "Turn Off Password Protected Sharing". If anyone has figured this out please let me know.
I have already exported the entire registry before and after adjusting the setting. Used Beyond Compare to locate any difference, but nothing useful was found. Any and all ideas are appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
保罗在这里的回答:
如何开启密码保护以编程方式共享或关闭?
可能为时已晚:),但希望对其他人有用。
以下步骤对我来说效果很好(它也适用于 W8 消费者预览版)。
将其关闭:
1 - 通过运行启用来宾帐户
2 - 通过运行获取来宾用户 SID,例如,
3 - 获得对注册表文件夹 HKLM\SECURITY 的写入权限
4 - 修改以下项(其中 $SID 是第 2 点中获取的 sid):
5 - 重新启动机器(到目前为止,我没有找到更好的方法使更改生效)
以再次打开它:
然后重新启动
paolo's answer from here:
How do I turn Password Protected Sharing on or off programmatically?
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
2 - Obtain guest user SID by running, for example,
3 - Obtain write access to registry folder HKLM\SECURITY
4 - Modify the following key, where $SID is the sid obtained in point 2, to:
5 - restart the machine (until now, I didn't find a better way to make the change effective)
to turn it on again:
then restart