luozhebai 发表于 2019-1-19 20:12:50

各位大神,请教SaltStack-2018.3.3调用64位powershell问题

各位,我在使用SaltStack-2018.3.3 管理windows过程中,需要用powershell导入ServerManager模块,Import-Module ServerManager。我发现salt默认调用的是32位的,路径C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe。
报错如下,
=====
PS C:\Users\Administrator> Import-Module ServerManager
Import-Module : 由于发生以下错误,无法加载 Windows PowerShell 管理单元 C:\Windows\assembly\GAC_MSIL\Microsoft.Windows.S
erverManager.PowerShell\6.1.0.0__31bf3856ad364e35\Microsoft.Windows.ServerManager.PowerShell.dll: 无法加载一个或多个请
求的类型。有关更多信息,请检索 LoaderExceptions 属性。
Loader Exceptions:
未能加载文件或程序集“Microsoft.Windows.ServerManager, Version=6.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e3
5”或它的某一个依赖项。系统找不到指定的文件。
未能加载文件或程序集“Microsoft.Windows.ServerManager, Version=6.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e3
5”或它的某一个依赖项。系统找不到指定的文件。
未能加载文件或程序集“Microsoft.Windows.ServerManager, Version=6.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e3
5”或它的某一个依赖项。系统找不到指定的文件。
未能加载文件或程序集“Microsoft.Windows.ServerManager, Version=6.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e3
5”或它的某一个依赖项。系统找不到指定的文件。
未能加载文件或程序集“Microsoft.Windows.ServerManager, Version=6.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e3
5”或它的某一个依赖项。系统找不到指定的文件。
未能加载文件或程序集“Microsoft.Windows.ServerManager, Version=6.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e3
5”或它的某一个依赖项。系统找不到指定的文件。
所在位置 行:1 字符: 14
+ Import-Module <<<<ServerManager
    + CategoryInfo          : ResourceUnavailable: (:) , PSSnapInException
    + FullyQualifiedErrorId : PSSnapInLoadFailure,Microsoft.PowerShell.Commands.ImportModuleCommand
PS C:\Users\Administrator>

=====

获取32位powershell可用Module,可以看到ServerManager是可以用的
=====
PS C:\Users\Administrator> Get-Module -ListAvailable

ModuleType Name                      ExportedCommands
---------- ----                      ----------------
Manifest   BitsTransfer            {}
Manifest   PSDiagnostics             {}
Manifest   ServerManager             {}
Manifest   TroubleshootingPack       {}

=====


而使用64位的powershell,路径C:\Windows\System32\WindowsPowerShell\v1.0

执行Import-Module ServerManager 没有问题
=====
PS C:\Users\Administrator> Import-Module ServerManager
PS C:\Users\Administrator>

=====

请教大家,如何将salt默认调用的32位powershell换为64位的powershell?


beson2000 发表于 2019-1-22 20:59:27

谢谢分享

wjang11 发表于 2019-1-30 19:30:13

学习学习

xiaozeze 发表于 2019-1-30 20:41:26

谢谢楼主分享啊

qypp19800211 发表于 2019-2-2 18:28:42

谢谢,正在学习虚拟化。。。。
页: [1]
查看完整版本: 各位大神,请教SaltStack-2018.3.3调用64位powershell问题