$InstallDir = 'C:\Program Files (x86)\Razer' Get-ChildItem -Path $InstallDir -Filter '*.dll' -Recurse | ForEach-Object { $Assembly = $_.FullName Write-Host "Queueing up $Assembly for NGEN installation." C:\Windows\Microsoft.NET\Framework\v4.0.30319\ngen.exe install $Assembly /queue:2 /nologo C:\Windows\Microsoft.NET\Framework64\v4.0.30319\ngen.exe install $Assembly /queue:2 /nologo } Get-ChildItem -Path $InstallDir -Filter '*.exe' -Recurse | ForEach-Object { $Assembly = $_.FullName Write-Host "Queueing up $Assembly for NGEN installation." C:\Windows\Microsoft.NET\Framework\v4.0.30319\ngen.exe install $Assembly /queue:2 /nologo C:\Windows\Microsoft.NET\Framework64\v4.0.30319\ngen.exe install $Assembly /queue:2 /nologo } C:\Windows\Microsoft.NET\Framework\v4.0.30319\ngen.exe eqi 2 C:\Windows\Microsoft.NET\Framework64\v4.0.30319\ngen.exe eqi 2