Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Match values in Array...

$
0
0

I have the following:

$Installapps = get-wmiobject -classname win32_product
$Installappsname = $Installapps.name
$Installappsver = $Installapps.version
$ArrGUID="CDBurnerXP (64 bit)","Citrix","Adobe Acrobat XI Standard","Nero","Microsoft InfoPath MUI (English) 2013","BlackBerry USB and Modem Drivers 7.0","Microsoft Visual C++ 2010  x64 Redistributable - 10.0.40219","Java(TM) 6 Update 32","Java 7 Update 55","Mozilla Firefox (en-US)"


foreach ($apps in $ArrGUID)
{
if ( $Installappsname -like $apps)

  {Write-Output  $apps" has been installed Successfully"}
  else
  {Write-Output  "*** ERROR *** CAN'T FIND $apps *****ERROR****"}
}

Looks up the software in win32_product class and compare it with values in a predetermined array. Ideally, I want the validation to work in such a way that if I was to look for "CDBur", CDBurnerXP (64 bit) would come up instead of the extact string. Any idea?? 

Viewing all articles
Browse latest Browse all 21975

Latest Images

Trending Articles



Latest Images

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