{"id":7061,"date":"2007-11-08T12:39:00","date_gmt":"2007-11-08T12:39:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/powershell\/2007\/11\/08\/update-gac-ps1\/"},"modified":"2019-02-18T13:16:25","modified_gmt":"2019-02-18T20:16:25","slug":"update-gac-ps1","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/powershell\/update-gac-ps1\/","title":{"rendered":"Update-Gac.ps1"},"content":{"rendered":"<p>Below is the content of the Update-GAC.ps1 script that I run whenever I install a new version of PowerShell. Our installation is supposed to ngen the assemblies in the background. If that works, it doesn&#8217;t work fast enough for me. Also I&#8217;ve seen lots of examples where people run this script long after their install and things get a TON faster so \u2026. The install team is looking into the issue but until then \u2013 here is the script I use: <\/p>\n<p><span>Set-Alias ngen @(<br \/>dir (join-path ${env:\\windir} &#8220;Microsoft.NET\\Framework&#8221;) ngen.exe -recurse |<br \/>sort -descending lastwritetime<br \/>)[0].fullName<br \/>[appdomain]::currentdomain.getassemblies() | %{ngen $_.location}<br \/><\/span><\/p>\n<p>&lt;Update 12\/4\/008&gt; NOTE &#8211; there is a updated (and better) version of this script <a href=\"http:\/\/blogs.msdn.com\/powershell\/archive\/2008\/09\/02\/speeding-up-powershell-startup-updating-update-gac-ps1.aspx\">HERE<\/a>.<\/p>\n<p>Cheers! <\/p>\n<p>Jeffrey Snover [MSFT]<br \/>Windows Management Partner Architect<br \/>Visit the Windows PowerShell Team blog at: <a href=\"http:\/\/blogs.msdn.com\/PowerShell\">http:\/\/blogs.msdn.com\/PowerShell<\/a><br \/>Visit the Windows PowerShell ScriptCenter at: <a href=\"http:\/\/www.microsoft.com\/technet\/scriptcenter\/hubs\/msh.mspx\">http:\/\/www.microsoft.com\/technet\/scriptcenter\/hubs\/msh.mspx<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Below is the content of the Update-GAC.ps1 script that I run whenever I install a new version of PowerShell. Our installation is supposed to ngen the assemblies in the background. If that works, it doesn&#8217;t work fast enough for me. Also I&#8217;ve seen lots of examples where people run this script long after their install [&hellip;]<\/p>\n","protected":false},"author":600,"featured_media":13641,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-7061","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-powershell"],"acf":[],"blog_post_summary":"<p>Below is the content of the Update-GAC.ps1 script that I run whenever I install a new version of PowerShell. Our installation is supposed to ngen the assemblies in the background. If that works, it doesn&#8217;t work fast enough for me. Also I&#8217;ve seen lots of examples where people run this script long after their install [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts\/7061","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/users\/600"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/comments?post=7061"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts\/7061\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/media\/13641"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/media?parent=7061"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/categories?post=7061"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/tags?post=7061"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}