PoshCode Archive  Artifact [92c9fd07fb]

Artifact 92c9fd07fb0758cab158872985fd8aa17265e2cfec9f23f1c39984c99047065c:

  • File Update-GAC.ps1 — part of check-in [cd693e6121] at 2018-06-10 14:01:03 on branch trunk — Latest version from http://blogs.msdn.com/powershell/archive/2008/09/02/speeding-up-powershell-startup-updating-update-gac-ps1.aspx (user: unknown size: 1019)

# encoding: ascii
# api: powershell
# title: Update-GAC
# description: Latest version from http://blogs.msdn.com/powershell/archive/2008/09/02/speeding-up-powershell-startup-updating-update-gac-ps1.aspx
# version: 0.1
# license: CC0
# x-poshcode-id: 577
# x-archived: 2008-09-19T16:44:17
#
#
# author: jeffrey snover
# url: http://blogs.msdn.com/powershell/archive/2008/09/02/speeding-up-powershell-startup-updating-update-gac-ps1.aspx
Set-Alias ngen (Join-Path ([System.Runtime.InteropServices.RuntimeEnvironment]::GetRuntimeDirectory()) ngen.exe)
[AppDomain]::CurrentDomain.GetAssemblies() |
    sort {Split-path $_.location -leaf} | 
    %{
        $Name = (Split-Path $_.location -leaf)
        if ([System.Runtime.InteropServices.RuntimeEnvironment]::FromGlobalAccessCache($_))
        {
            Write-Host "Already GACed: $Name"
        }else
        {
            Write-Host -ForegroundColor Yellow "NGENing      : $Name"
            ngen $_.location | %{"`t$_"}
         }
      }