对远程映射驱动器的查询不一致
Inconsistent query on remote mapped drives
我使用下面的 Powershell 脚本来检查远程 PC 上的映射驱动器。
有些 PC 给出了预期的结果,有些则没有。
Get-WmiObject Win32_MappedLogicalDisk -computer HW059 | select name, providername
我使用的帐户在所有 PC 上拥有相同的管理员权限,因此我认为问题不是由用户权限引起的。
我想知道是否有任何服务需要启动/与脚本相关?
我检查了所有 PC 上的 WMI 服务 运行。
抱歉,我是脚本新手。
有人可以帮忙吗?
Powershell result
映射驱动器是用户会话的功能,它们在系统中默认不存在。即使所有用户都映射了相同的磁盘(即 S: 映射到 \\server\share),如果没有登录用户,S: 也不会存在。
请看MSDN的备注 (你是下面描述中的用户A)
The instances returned for this class are as follows, supposing that user A is enumerating the instances:
The provider looks for a logon session of user A on that machine: If there is one (and only one) such logon session, then the provider returns the mapped drives of that session. If there is more than one session for user A on the machine, then no mapped drive instances are returned (because the provider has no reasonable way of deciding which session to use).
If there are no sessions of user A running, and there is a locally logged on user B:
If there is a single session for user B, then the provider impersonates A and returns the mapped drives of user B. This case supports the scenario of Helpdesk wanting to see the instances of a locally logged on user. However, whether instances are returned depends on the Local Security Policy settings in the Control Panel Administrative Tools. If the following policy is set to "Object Creator", then no mapped drive instances are returned, even if A is a member of the Administrators group: "System object: default owner for objects created by members of the administrators group." Again, if there is more than one session of user B running on the machine, then the provider has no way of deciding which to use. In this case, no mapped drive instances are returned.
我使用下面的 Powershell 脚本来检查远程 PC 上的映射驱动器。 有些 PC 给出了预期的结果,有些则没有。
Get-WmiObject Win32_MappedLogicalDisk -computer HW059 | select name, providername
我使用的帐户在所有 PC 上拥有相同的管理员权限,因此我认为问题不是由用户权限引起的。
我想知道是否有任何服务需要启动/与脚本相关? 我检查了所有 PC 上的 WMI 服务 运行。
抱歉,我是脚本新手。 有人可以帮忙吗? Powershell result
映射驱动器是用户会话的功能,它们在系统中默认不存在。即使所有用户都映射了相同的磁盘(即 S: 映射到 \\server\share),如果没有登录用户,S: 也不会存在。
请看MSDN的备注 (你是下面描述中的用户A)
The instances returned for this class are as follows, supposing that user A is enumerating the instances:
The provider looks for a logon session of user A on that machine: If there is one (and only one) such logon session, then the provider returns the mapped drives of that session. If there is more than one session for user A on the machine, then no mapped drive instances are returned (because the provider has no reasonable way of deciding which session to use).
If there are no sessions of user A running, and there is a locally logged on user B:
If there is a single session for user B, then the provider impersonates A and returns the mapped drives of user B. This case supports the scenario of Helpdesk wanting to see the instances of a locally logged on user. However, whether instances are returned depends on the Local Security Policy settings in the Control Panel Administrative Tools. If the following policy is set to "Object Creator", then no mapped drive instances are returned, even if A is a member of the Administrators group: "System object: default owner for objects created by members of the administrators group." Again, if there is more than one session of user B running on the machine, then the provider has no way of deciding which to use. In this case, no mapped drive instances are returned.