Powershell Get ItemProperty正在向注册表值返回1个额外字符

Powershell Get ItemProperty正在向注册表值返回1个额外字符,powershell,hyper-v,Powershell,Hyper V,测试内容。ps1: Set-Location HKLM: $RegistryKeys = (Get-ChildItem HKLM:\SYSTEM\CurrentControlSet\services\VMSMP\Parameters\NicList) foreach ($Key in $RegistryKeys){ if ((Get-ItemProperty $Key).FriendlyName -like "*Corp*") { Write-Host "Found Sw

测试内容。ps1:

Set-Location HKLM:
$RegistryKeys = (Get-ChildItem HKLM:\SYSTEM\CurrentControlSet\services\VMSMP\Parameters\NicList)
foreach ($Key in $RegistryKeys){
    if ((Get-ItemProperty $Key).FriendlyName -like "*Corp*") {
        Write-Host "Found Switch in $Key"
        $SwitchName = (Get-ItemProperty -Path $Key).SwitchName
        $PortName = (Get-ItemProperty -Path $Key).PortName
        Write-Host $SwitchName
        Write-Host $PortName
    }
    else{}
}
输出(我连续快速运行了4次,强调了添加到返回值中的奇怪的额外字符):

添加到注册表项的额外字符是什么?除了那个额外的垃圾字符外,返回的信息是正确的。有时是o、m、s,但似乎总是只有一个字符(有时不添加额外字符)


令人困惑……

我的最佳猜测是,您正在获取多字符串键的值,而那些有趣的字符就是字符串分隔符。但是,我的计算机上没有
VMSMP
键来验证我的理论。

您试图获取的值的数据类型是什么?
Found Switch in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\VMSMP\Parameters\NicList\03BDF338-4BC5-4896-8C40-55C91DEBB50D
D00D57C1-8FE2-447F-ABBD-B672CA2683CCø
D5BD78A2-543F-4F15-9FA6-729F62AE09A3ø
Found Switch in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\VMSMP\Parameters\NicList\03BDF338-4BC5-4896-8C40-55C91DEBB50D
D00D57C1-8FE2-447F-ABBD-B672CA2683CCø
D5BD78A2-543F-4F15-9FA6-729F62AE09A3ø
Found Switch in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\VMSMP\Parameters\NicList\03BDF338-4BC5-4896-8C40-55C91DEBB50D
D00D57C1-8FE2-447F-ABBD-B672CA2683CCø
D5BD78A2-543F-4F15-9FA6-729F62AE09A3ø
Found Switch in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\VMSMP\Parameters\NicList\03BDF338-4BC5-4896-8C40-55C91DEBB50D
D00D57C1-8FE2-447F-ABBD-B672CA2683CCø
D5BD78A2-543F-4F15-9FA6-729F62AE09A3ø
Found Switch in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\VMSMP\Parameters\NicList\03BDF338-4BC5-4896-8C40-55C91DEBB50D
D00D57C1-8FE2-447F-ABBD-B672CA2683CCm
D5BD78A2-543F-4F15-9FA6-729F62AE09A3m