我正在使用PowerShell自动化AppFabric安装,我遇到了一个问题,即脚本调用安装程序,等待它完成,但我无法从相同的上下文导入已安装的模块.即:
Start-Process "C:\provision\WindowsServerAppFabricSetup_x64.exe" -ArgumentList "/i /GAC" -Wait Import-Module DistributedCacheConfiguration # ...do configuration things...
哪个错误: The specified module 'DistributedCacheConfiguration' was not loaded because no valid module file was found in any module directory.
如果您关闭并重新打开PowerShell,脚本运行正常.Start-Sleep 60
在安装程序和配置之间添加一个没有帮助,所以我尝试调用它,好像PowerShell正在重新启动:
C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe C:\provision\appfabric_config.ps1
抛出了同样的错误.如何让PowerShell识别新安装的模块?