Link to home
Start Free TrialLog in
Avatar of Kelly Garcia
Kelly GarciaFlag for United Kingdom of Great Britain and Northern Ireland

asked on

import-csv powershell

HI All,

 I have a excel csv file with a list of computers and applications, I only want to know which computers do not have a specific application. how do I do this?

the csv file contains the fields, computer and application name


 thank you in advance ,
kay
Avatar of Kelly Garcia
Kelly Garcia
Flag of United Kingdom of Great Britain and Northern Ireland image

ASKER

I have written this line of code, however it gives an error:

 Import-Csv '.\REPORT_ Search all Applications on Users Machines (ALL USERS).csv' | select computer | ? {$_.applicationname -like *fireeye*}

Open in new window

Avatar of Chris Dent
What error?

You'll need to remove Select from that though, by using Select you remove the ApplicationName property you're trying to filter on. And you need some quotes around your value to the right of the "like" operator (which may be the error).
Import-Csv '.\REPORT_ Search all Applications on Users Machines (ALL USERS).csv' | Where-Object {$_.applicationname -like "*fireeye*" }

Open in new window

this tells me all the machines with the application, I want machines that do not have the application installed
Then use "notlike" instead.
Import-Csv '.\REPORT_ Search all Applications on Users Machines (ALL USERS).csv' | Where-Object {$_.applicationname -notlike "*fireeye*" }

Open in new window

it gives me the other applications that are installed on that machine, I only want to know if the machine in question have fireeye installed
ASKER CERTIFIED SOLUTION
Avatar of Chris Dent
Chris Dent
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks Qlemo :)