Closed w-devin closed 3 years ago
在代码样例:
$RegPath = "Registry::HKEY_CURRENT_USER\Software\Microsoft\Terminal Server Client\Servers\" $QueryPath = dir $RegPath -Name foreach($Name in $QueryPath) { Try { $User = (Get-ItemProperty -Path $RegPath$Name -ErrorAction Stop | Out-Null).UsernameHint Write-Host "Server:"$Name Write-Host "User:"$User"`n" } Catch { Write-Host "No RDP Connections History" } }
| Out-Null 应该会导致$User 为空
| Out-Null
感谢,已更正
在代码样例:
| Out-Null
应该会导致$User 为空