我想知道是否有方法可以找到特定计算机的注册表值。我能找到的唯一方法就是进入pssession,然后退出。
$Computer = Read-Host "Enter the PC Name: "
$connection=test-connection -ComputerName $Computer -Quiet
if($connection -eq $True) {
Enter-PSSession $Computer
$TrendServer= Get-ItemProperty -Path Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\TrendMicro\PC-cillinNTCorp \CurrentVersion | Select Server
write-output $TrendServer
if($TrendServer -ne $null){
Exit-PSSession
}
} else{Write-Output "Computer is not available. Please check Lan Sweeper "}发布于 2018-05-24 20:23:04
如果它是使用Windows Installer安装的,您可以使用WMI,尽管众所周知这个类非常慢:
Get-CimInstance -Query "SELECT * FROM Win32_Product WHERE Name = 'TrendMicro'" `
-ComputerName $computer将名称从'TrendMicro‘更改为任何实际名称(我没有安装它进行检查),并且对于较旧版本的PowerShell,使用Get-WmiObject而不是Get-CimInstance。
欲了解更多信息,请访问:Working with Software Installations
https://stackoverflow.com/questions/50509012
复制相似问题