Powershell:在目标系统上安装模块

标签 powershell powershell-2.0

当我这样做时 -

PS C:\> $env:psmodulePath.split(";")

我得到两个文件夹 - 即用户模块文件夹和系统模块文件夹

User Module Folder
C:\Users\winUser1\Documents\WindowsPowerShell\Modules

System Module Folder
C:\Windows\system32\WindowsPowerShell\v1.0\Modules\

现在,当我在系统模块文件夹下复制 psm1 文件并尝试从 ISE x86 执行导入模块时,脚本未加载,但反之亦然 - 即从用户模块文件夹工作。

但是,在生产环境中,我希望任何用户都能够执行脚本。知道如何实现相同的目标吗?

注意:我使用的是 Windows 2008 R2 和 Windows 7 - 所有 64 位版本,但脚本应作为 32 位版本运行

最佳答案

尝试将它们复制到SysWOW64文件夹下。 SysWOW64文件夹包含32位系统文件,System32包含64位系统文件

C:\windows\SysWOW64\WindowsPowerShell\v1.0\Modules

关于Powershell:在目标系统上安装模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10501484/

相关文章:

powershell - 在 Windows Server 2016 中使用命令行获取 exe 的 'Copyright' 信息字段

arrays - Powershell 从包含大量字符串的大文本文件中删除任何行

powershell - Get-WindowsUpdateLog 流重定向

powershell - 如何在PowerShell中解析日期?

powershell - 在 PowerShell 中为 -replace 和 Set-Content 组合文件 IO

windows - 我可以查询什么来查看 Windows 是否已启动并完成更新?

powershell - 如何显示 Visual Studio Online 构建任务 Write-Verbose 语句?

Powershell - 获取 AD 用户的姓名首字母

powershell - Windows PowerShell 2.0(绝对入门)-书中最后一个项目的错误

powershell - 使用powershell脚本安装软件