Чтобы отделить имя файла от полного пути, вы можете использовать командировку Powershells Split-Path
следующим образом:
$FullPath = "C:\Windows\System32\DriverStore\FileRepository\pantherpointsystem.inf_amd64_bde4cf569a728803\pantherpointsystem.inf"
$FileName = $FullPath | Split-Path -Leaf
или использовать .NET следующим образом:
$FullPath = "C:\Windows\System32\DriverStore\FileRepository\pantherpointsystem.inf_amd64_bde4cf569a728803\pantherpointsystem.inf"
$FileName = [System.IO.Path]::GetFileName($FullPath)
В вашемВ этом случае я бы использовал вычисляемое свойство для заполнения Hashtable:
$HashTable = Get-WindowsDriver –Online -All |
Where-Object {$_.Driver -like "oem*.inf"} |
Select-Object Driver, @{Name = 'FileName'; Expression = {$_.OriginalFileName | Split-Path -Leaf}},
ClassDescription, ProviderName, Date, Version
Write-Host "All installed third-party drivers" -ForegroundColor Yellow
$HashTable | Sort-Object ClassDescription | Format-Table