FriendsOfMDT / PSD

PowerShell Deployment
MIT License
505 stars 78 forks source link

Function Find-PSDFile can return multiple matches breaking functionality #177

Open Rehpicul opened 2 weeks ago

Rehpicul commented 2 weeks ago

Give how there are duplicates of the cache folder in the tree the Find-PSDFile can return multiple matches. I am sure there are multiple ways to resolve this issue however I simply added Select-Object -First 1 to make sure only one match was returned. The line number I have is 130 however I have made changes to get UNC paths working so that might not match the original line number. The function referenced can be found in the PSDUtility.psm1 file.

I changed line from: $File = Get-ChildItem -Path $LocalPath -Recurse -Filter $FileName -File I changed the line to: $File = Get-ChildItem -Path $LocalPath -Recurse -Filter $FileName -File | Select-Object -First 1