I have two objects in my Powershell script - Application + Computer Objects which are imported from a csv file
# import applications
$apps = @()
$apps = Import-CSV C:\Working\fcheck_v2\apps.csv
# import computer objects
$compobj = @()
$compobj = Import-CSV C:\Working\fcheck_v2\compobj.csv
The structure of apps.csv is as follows:
appname location lob
Core C$\errlog.ini RESEARCH
Blmbg C$\errlog.ini RESEARCH
Blmbg2 C$\errlog.ini RESEARCH
MLFR C$\errlog.ini LEGAL
The structure of compobj.csv is as follows:
hostname lob
192.169.226.2 RESEARCH
192.169.226.5 HR
How would I use testpath to check whether a particular application exists on a computer?
For example I would want to test that all the computer objects in the RESEARCH lob have the RESEARCH apps installed on the machines and print out the results in a table like this:
hostname lob core blmbg blmbg2 mlfr
192.169.226.2 RESEARCH True True False Frue
192.169.226.5 HR True N/A N/A N/A
If the machine passes Test-Path - then the status is set to True
If the machine fails Test-Path+ app needs to be installed (i.e. it is in the lob) - then the status is set to False
If the machine fails Test-Path + app doesn't need to be installed (i.e. it is not in the lob) - then the status is set to N/A
Thanks.