Powershell:在目标系统上安装模块 [英] Powershell: Installing Modules on Target System
问题描述
当我这样做时 -
PS C:\> $env:psmodulePath.split(";")
我得到两个文件夹 - 即用户模块文件夹和系统模块文件夹.
I get two folders - i.e. User Module Folder and System Module Folder.
User Module Folder
C:\Users\winUser1\Documents\WindowsPowerShell\Modules
System Module Folder
C:\Windows\system32\WindowsPowerShell\v1.0\Modules\
现在,当我复制系统模块文件夹下的 psm1 文件并尝试从 ISE x86 执行导入模块时,脚本未加载,但反之亦然 - 即从用户模块文件夹工作.
Now, when I am copying my psm1 files under system module folder, and trying to do import-module from ISE x86, the scripts are not getting loaded, but vice-versa is true - i.e. working from user module folder.
但是,在生产环境中,我希望任何用户都能够执行脚本.知道如何实现相同的目标吗?
But, in a production environment, I want any user to be able to execute the scripts. Any idea how to achieve the same ?
注意:我使用的是 Windows 2008 R2 和 Windows 7 - 所有 64 位版本,但脚本应作为 32 位版本运行
推荐答案
尝试将它们复制到 SysWOW64 文件夹下.SysWOW64文件夹包含32位系统文件,System32文件夹包含64位系统文件
Try to copy them under the SysWOW64 folder. The SysWOW64 folder contains the 32-bit system files and the System32 contains the 64-bit system files
C:\windows\SysWOW64\WindowsPowerShell\v1.0\Modules
C:\windows\SysWOW64\WindowsPowerShell\v1.0\Modules
这篇关于Powershell:在目标系统上安装模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!