Powershell起動高速化について(64bit対応版)

PowerShellの起動を速くする

http://blog.powershell-from.jp/?p=276

このリンクのPowershell高速化方法を前々から使わせて貰っているのです、

途中でエラーが出るのが気になるので修正版を作ってみました

(64bitの2008R2とWindows7でエラーがでることを確認しています)

Set-Alias ngen @(
dir (join-path ${env:\windir} "Microsoft.NET\Framework") ngen.exe -recurse |
sort -descending lastwritetime
)[0].fullName

Set-Alias ngen64 @(
dir (join-path ${env:\windir} “Microsoft.NET\Framework64”) ngen.exe -recurse |
sort -descending lastwritetime
)[0].fullName

[appdomain]::currentdomain.getassemblies() | % {
if($_.location -match $(‘\\assembly\\GAC_64’)){
ngen64 install $_.location
} else {
ngen install $_.location
}
}

# 2015/1/8 コマンド修正しました

・エラー内容
以下のような内容です。64bitのアセンブリを32bitのngenでコンパイルしようとしているため
エラーが出ているようです

Microsoft (R) CLR Native Image Generator - Version 2.0.50727.5420
Copyright (c) Microsoft Corporation. All rights reserved.
Installing assembly C:\Windows\assembly\GAC_64\System.Transactions\2.0.0.0__b77a
5c561934e089\System.Transactions.dll
Failed to find dependencies of image C:\Windows\assembly\GAC_64\System.Transacti
ons\2.0.0.0__b77a5c561934e089\System.Transactions.dll because this image or one
of its dependencies is not a valid Win32 application.
Compiling assembly C:\Windows\assembly\GAC_64\System.Transactions\2.0.0.0__b
77a5c561934e089\System.Transactions.dll ...
Error compiling C:\Windows\assembly\GAC_64\System.Transactions\2.0.0.0__b77a5c56
1934e089\System.Transactions.dll: 間違ったフォーマットのプログラムを読み込もうと
しました。 (HRESULT からの例外: 0x8007000B)
Uninstalling assembly C:\Windows\assembly\GAC_64\System.Transactions\2.0.0.0__b7
7a5c561934e089\System.Transactions.dll because of an error during compilation.
間違ったフォーマットのプログラムを読み込もうとしました。 (Exception from HRESULT
: 0x8007000B)

コメントを残す