Skip to content

Instantly share code, notes, and snippets.

@garethj-msft
Created May 17, 2017 16:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save garethj-msft/b0a79d8d6368687cd9aaec92350b8751 to your computer and use it in GitHub Desktop.
Save garethj-msft/b0a79d8d6368687cd9aaec92350b8751 to your computer and use it in GitHub Desktop.
PowerShell to turn off JIT optimization for all DLLs in a directory
$path = get-location
$files = get-Childitem $path -recurse -include *.dll
$content = "[.NET Framework Debugging Control]`r`nGenerateTrackingInfo=1`r`nAllowOptimize=0"
$count
foreach ($file in $files)
{
if ($file.fullname.contains(".dll") -or $file.fullname.contains(".DLL"))
{
$count++
write-host ("{0:000#}:" -f $count) $file.fullname -NoNewline
$t = ($file.fullname -replace(".dll", "")) + ".ini"
}
if ($t -ne $null)
{
$fileExists = Test-Path $t
if ($fileExists -eq $false)
{
write-host " ==> created new ini"
out-file -filePath $t -inputobject $content
}
else
{
write-host " ==> ini already exists"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment