Skip to content

Instantly share code, notes, and snippets.

@grenade
Last active August 29, 2015 13:56
Show Gist options
  • Save grenade/8864317 to your computer and use it in GitHub Desktop.
Save grenade/8864317 to your computer and use it in GitHub Desktop.
Warning: This script is incomplete. Its not a good implementation since the correct token usage is commented out and instead all assemblies are registered. Register an assembly for strong name verification skipping using the public key .snk file.
param(
[string] $snk
)
$noSDK = $true
foreach ($folder in @("Program Files", "Program Files (x86)")){
$sns = (Get-ChildItem -Path ("{0}\{1}\Microsoft SDKs\Windows" -f $env:SystemDrive, $folder) -Filter "sn.exe" -Recurse | Select-Object FullName)
foreach ($sn in $sns){
#$token = (& $sn.FullName -tp $snk | Select-String "^Public key token is " | % {$_.Line.Split(" ")[4]})
#& $sn.FullName -Vr *,$token
& $sn.FullName -Vr *
$noSDK = $false
}
}
if($noSDK) {
Write-Error "No Windows SDK detected."
exit 1
} else {
Write-Host ("Token: {0} registered for strong name verification skipping." -f $token)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment