我嘗試運行調用命令的PowerShell腳本。在那個命令中,我想寫一個程序集給GAC。在GACUTIL中使用PowerShell中的Invoke-Command安裝程序集(無權限)
這是代碼:
invoke-command -computername COMPUTERNAME -scriptblock {
$gacUtil = "${Env:ProgramFiles(x86)}\Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools\gacutil.exe";
& $gacutil '/nologo' '/if' '\\fileserver\..\Assembly.dll'
}
PowerShell中然後返回此錯誤:
Failure adding assembly to the cache: Administrator permissions are needed to use the selected options. Use an administrator command prompt to complete these tasks.
一些google搜索後,我添加了一個-Credential
參數給invoke命令(與管理員憑據) ,但這仍然不起作用。
任何想法?
如果你在Vista,七個或以上的操作系統,請嘗試以管理員身份執行powershell。 –
已經這樣做了,雖然 – Mathieu
mmmh,但有一點Google使用GAC中遠程安裝程序集的方法:http://www.cptloadtest.com/2005/07/26/Remote-Deployment-To-The-GAC .aspx –