【发布时间】:2018-05-28 09:19:39
【问题描述】:
在最近的 Windows 10 更新后,我使用 cloudberry 管理单元的 powershell 脚本不再工作。我已经重新安装了cloudberry,但没有成功。
即使管理单元显示为已注册:
PS C:\> Get-PSsnapin -Registered
Name : CloudBerryLab.Explorer.PSSnapIn
PSVersion : 2.0
Description : CloudBerry Explorer snap-in for PowerShell
Powershell 无法识别命令:
PS C:\> $destination = Get-CloudFilesystemConnection | Select-CloudFolder
"\\diskstation\drive1\backups\ow-data\"
Get-CloudFilesystemConnection : The term 'Get-CloudFilesystemConnection' is
not recognized as the name of a cmdlet,
function, script file, or operable program. Check the spelling of the name,
or if a path was included, verify that the
path is correct and try again.
At line:1 char:16
+ $destination = Get-CloudFilesystemConnection | Select-CloudFolder "\\ ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Get-
CloudFilesystemConnection:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
管理单元也被添加到当前会话中,但仍未显示:
PS C:\> Add-PSSnapin CloudBerryLab.Explorer.PSSnapIn
PS C:\> Get-PSsnapin
Name : Microsoft.PowerShell.Core
PSVersion : 5.1.17134.81
Description : This Windows PowerShell snap-in contains cmdlets used to
manage components of Windows PowerShell.
【问题讨论】:
-
当您使用
Get-PSSnapin而不使用-Registered时是否显示? -
不,没有 -registered 就不会显示
-
不,没有 -registered 就不会显示 这就是问题所在。它只是注册的,但你没有将它添加到当前会话中。
-
正在运行的脚本在第一行执行 Add-PSSnapin。如果没有 -registered,它仍然不会显示在 Get-PSsnapin 中。如果我在同一个会话中再次调用 Add-PSSnapin,我会收到一个错误,表明它已被添加。
-
在当前会话中添加管理单元时是否遇到任何错误?导入管理单元时是否尝试使用
-Verbose参数:Add-PSSnapin CloudBerryLab.Explorer.PSSnapIn -Verbose?$Error自动变量有什么东西吗?
标签: powershell cloudberry