Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

PowerShell If DisplayName Contains

$
0
0
I'm trying to work out if remote computer have Symantec client installed on them. To do this, I have a list of computer names, and am trying to check them against the code below:

$List = Get-ItemProperty HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\* | 
Select-Object DisplayName |
Format-Table -AutoSize

if ($List -like '*Symantec*')
{ Write-Host "Symantec is installed." -ForegroundColor Green }
else
{ Write-Host "Symantec is not installed." -ForegroundColor Red }

I've got 2 questions: 1. How do I make this work for remote computers? and 2. Why is my 'if' statement not working. It only returns the 'else' statement at the moment.


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>