Im basically comparing an short list of PC names with our active directory, the first file is the list of pcs i have to check, the second file is the ad list that i got with following command
$ADcomputer = get-adcomputer -Filter "name -Like '*'" -Searchbase "DC=**,DC=******,DC=**"
($ADcomputer).name | Out-file "C:\temp\ADComputer.csv"
In both lists there are only pc names in split "A" most of them are built like "PC23425" just with various numbers (there are some exceptions of course but i dont need to check for them only for pcs with this pattern).
The list.csv is built like this
PC020682
PC020891
PC020953
PC021999
I read several posts about this and im very sure i need to use a foreach loop for that, but since i dont use powershell very often i aint sure how to pull it off.
What i try is
$Path = "C:\temp"
$ComputerList = Import-Csv -Path "$($path)\ADcomputer.csv"
$ComputerAchiv = Import-Csv -Path "$($path)\List.csv"
But i have no idea how to build the foreach loop.