Networking Powershell检测到额外的映射驱动器

Networking Powershell检测到额外的映射驱动器,networking,powershell,windows-xp,Networking,Powershell,Windows Xp,在Windows PC(比如“MYPC”)上,我有多个映射驱动器;根据网络使用: >net use New connections will be remembered. Status Local Remote Network ------------------------------------------------------------------------------- OK X:

在Windows PC(比如“MYPC”)上,我有多个映射驱动器;根据
网络使用

>net use
New connections will be remembered.


Status       Local     Remote                    Network

-------------------------------------------------------------------------------
OK           X:        \\BLAHBLAH1\e$            Microsoft Windows Network
OK           Y:        \\BLAHBLAH2\e$            Microsoft Windows Network
OK           Z:        \\BLAHBLAH3\s$            Microsoft Windows Network
The command completed successfully.
但当我在那台电脑上运行Powershell时:

$disks = Get-WmiObject -Class Win32_MappedLogicalDisk -Filter "DeviceID='Z:'"
foreach($disk in $disks)
{
      [Console]::WriteLine("DEBUG: " + $disk.Name + " is " + $disk.ProviderName );
}
它返回:

DEBUG: \\MYPC\root\cimv2:Win32_MappedLogicalDisk.DeviceID="Z:",SessionID="4491554321" is \\OTHERPC\c$\
DEBUG: \\MYPC\root\cimv2:Win32_MappedLogicalDisk.DeviceID="Z:",SessionID="3129225404" is \\BLAHBLAH3\s$
DEBUG: \\MYPC\root\cimv2:Win32_MappedLogicalDisk.DeviceID="Z:",SessionID="5884378361" is \\BLAHBLAH3\s$
这些其他Z映射驱动器来自哪里?它们如何占用相同的驱动器号?我能告诉他们是否可以安全移除,如果可以,如何移除

MYPC实际上是一台服务器,所以我不能仅仅擦除所有映射的驱动器(我通常会这样做)


如果这是由于其他用户显示映射驱动器造成的,我如何将Powershell更改为仅限于登录用户(确切地说,
net use
的操作方式)?

您是否尝试测试设备的可用性或状态属性? 这可能会导致本地登录用户使用网络驱动器。请参见


可能您正在运行一个终端服务器,因此请检查Win32_LogonSession类以获取有关providerName中会话id的更多信息

是,这似乎是正确的路径。。。我必须过滤掉所有映射的驱动器,而不是我登录的用户。