无法加载文件或程序集 - Powershell

问题描述

我正在尝试使用 Powershell 中的 Posh-SSH 模块通过 SFTP 发送文件

但是,我只是使用以下命令在 powershell 中以管理员权限安装模块:

Install-Module Posh-SSH -Force
iex (New-Object Net.WebClient).DownloadString("https://gist.github.com/darkoperator/6152630/raw/c67de4f7cd780ba367cccbc2593f38d18ce6df89/instposhsshdev")

但是,当我在没有管理员权限的情况下运行 Powershell ISE 并调用我的脚本时,会出现下一个异常:

The 'New-SFTPSession' command was found in the module 'Posh-SSH',but the 
module Could not be loaded. For more information,run 'Import-Module Posh-SSH'.

根据 Powershell 的建议,我添加了命令“Import-Module Posh-SSH”,但出现了另一个异常:

Could not load file or assembly 'netstandard,Version=2.0.0.0,Culture=neutral,PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. 
The system cannot find the file specified.

那么,知道如何解决这个问题吗?

解决方法

以管理员身份执行一次,然后工作!