PowerShell 원격 세션에서 어셈블리를 실행하려고하면이 오류가 발생합니다.
Could not load file or assembly 'System.Xml.Linq, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089' or one of its dependencies. The system cannot find
the file specified.
원격 세션을 시작했습니다.
Enter-PsSession -ComputerName myComputer -ConfigurationName Microsoft.Powershell
-Credential domain\user
그러나 동일한 사용자와 동일한 컴퓨터에서 실행하면 문제가 없습니다.
최신 정보:
나는 뭔가를하고 싶다.
if (Test-Path $AssemblyPath) {
$fileStream = ([System.IO.FileInfo] (Get-Item $AssemblyPath)).OpenRead()
$assemblyBytes = New-Object byte[] $fileStream.Length
$fileStream.Read($assemblyBytes, 0, $fileStream.Length) | Out-Null
$fileStream.Close()
$assemblyLoaded = [System.Reflection.Assembly]::Load($assemblyBytes) | Out-Null
$myObject = New-Object namespaceInMyAssembly.ClassInMyAssembly
$myObject.doMyAction()
}
문제를 발견했습니다. Powershell이 powershell.exe.config에서 .Net 4 용으로 구성되었지만 wsmprovhost.exe.config에서는 구성되지 않았습니다. 그래서 원격 세션에서 .Net 4 어셈블리를로드 할 수 없습니다. 이 질문을 참조하십시오 .
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다