Hello there,
The PowerShellImport-Csv cmdlet is an excellent way of reading data from a tabulated source such as a CSV file. You can use the ForEach loop to then iterate over each row in the CSV data.
In the below script you can replace user list with reference software and user data with difference software.
$Path = "C:\PowerShell"
$UserList = Import-Csv -Path "$($path)\Userlisr.csv"
$UserData = Import-Csv -Path "$($path)\UserData.csv"
$UserOutput = @()
ForEach ($name in $UserList)
{
$userMatch = $UserData | where {$_.UserName -eq $name.usernames}
If($userMatch)
{
# Process the data
$UserOutput += New-Object PsObject -Property @{UserName =$name.usernames;column1 =$userMatch.column1;column2 =$userMatch.column2}
}
else
{
$UserOutput += New-Object PsObject -Property @{UserName =$name.usernames;column1 ="NA";column2 ="NA"}
}
}
$UserOutput | ft
-----------------------------------------------------------------------------------------------------------------------------
--If the reply is helpful, please Upvote and Accept it as an answer--