MapNetworkDrive 将接受任何密码
我正在编写一个脚本,用于向我工作的学校的学生提供的 Windows 笔记本电脑添加网络共享。
该脚本是用VBS编写的,并使用MapNetworkDrive功能,因此非常简单,只有两个对话框询问用户名和密码。但是,当我用自己的用户名测试它时,它似乎完全忽略我输入的密码,并且可能使用存储在某处的密码,因为它总是映射驱动器。有谁知道这些凭据在 Windows 7 中存储在哪里? (它没有存储在凭证存储中,我检查过)
I am writing a script for adding a network share to windows laptops provided for students at the school i work at.
The script is written in VBS, and uses the MapNetworkDrive function, so it is very simple, just two dialogs asking for username and password. But when I test it with my own username it seams to completely ignore the password I enter and, presumably, use a password stored somewhere, as it allways maps the drive. Does anyone know where these credentials are stored in windows 7? (It is not stored in credential storage, i checked)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
凭据根本不存储在任何地方。相反,Windows 使用当前登录用户的凭据来验证与共享资源的连接。也就是说,如果当前登录到本地计算机的用户的用户名和密码与远程计算机上具有相应凭据的用户相匹配,则访问将被的确。
让我看看是否可以用一个例子更清楚地解释这一点。假设我使用用户名“Cody Gray”和密码“1234”登录笔记本电脑。然后,我尝试启动与台式计算机上的共享资源的连接。由于我在台式计算机上具有相同的用户名和密码,并且该用户帐户具有足够的权限来远程连接到共享资源,因此我将自动进行身份验证并自动授予访问权限。但是,如果我尝试连接到我没有帐户的同事的一台计算机,我将需要提供具有有效访问凭据的用户名和密码。
仅当当前登录用户的凭据未能成功进行身份验证时,才会使用您向 WSH
MapNetworkDrive
方法提供的用户名和密码。 文档说:简而言之,出于测试目的,您可能会在计算机上创建一个与服务器上的帐户不直接对应的新帐户。如果学生已经在服务器上拥有帐户,则没有理由要求他们再次输入用户名和密码; Windows 已经知道它是什么,并且将自动使用它进行身份验证。
The credentials aren't stored anywhere at all. Rather, Windows is using the credentials of the currently logged-in user to authenticate the connection to the shared resource. That is to say, if the user name and password of the user currently logged in to the local machine matches a user with the appropriate credentials on the remote machine, access will be granted.
Let me see if I can explain that more clearly with an example. Say I'm logged in to my laptop with the user name "Cody Gray" and the password "1234". Then, I try to initiate a connection to a shared resource on my desktop computer. Since I have the same user name and password on my desktop computer, and that user account has sufficient privileges to connect to shared resources remotely, I'll be automatically authenticated and access will be automatically granted. However, if I try to connect to one of my coworkers' machines, on which I do not have an account, I'll be required to provide a user name and password with valid access credentials.
The user name and password you supply to the WSH
MapNetworkDrive
method are used only if the credentials of the currently logged-in user failed to authenticate successfully. The documentation says:In short, for testing purposes, you might create a new account on your computer that doesn't correspond directly to an account on the server. And if the students already have accounts on the server, there's no reason to require them to enter their user name and password again; Windows already knows what it is, and it will be used for authentication automatically.