Untitled
unknown
powershell
2 years ago
860 B
3
Indexable
# Variables $domain = "atp.group.tld" $csvFile = "C:\users\fle\acc_test.csv" # Read the user principal names from the CSV file $users = Import-Csv -Path $csvFile # Retrieve computer descriptions in the domain $computerDescriptions = Get-ADComputer -Filter * -Properties Description -Server $domain | Select-Object Name, Description # Find all computers with exact or similar values to the users $matchedComputers = foreach ($user in $users) { $searchValue = $user.ColumnName # Replace "ColumnName" with the actual column name in your CSV file $matchedDescriptions = $computerDescriptions | Where-Object { $_.Description -like "*$searchValue*" } $matchedDescriptions | Select-Object -Property *, @{Name = "SearchValue"; Expression = { $searchValue }} } # Output the matched computers $matchedComputers
Editor is loading...