【发布时间】:2013-09-10 11:55:08
【问题描述】:
我正在尝试在我的公司中设置一个 Endpoint-Server,并且正在努力连接它。为了进行测试,我在全局模块路径中放置了一个 RcLogUtil 模块
C:\windows\system32\WindowsPowershell\v1.0\Modules\RcLogUtil\
导出函数
'Out-LogToEventLog','New-LogMessage'
计划是让一组特定的用户只访问那些日志记录功能。
我创建了一个 SessionConfiguration:
New-PSSessionConfigurationFile -Path C:\Scripts\LoggerEp.pssc `
-SessionType RestrictedRemoteServer `
-LanguageMode FullLanguage `
-ExecutionPolicy Unrestricted `
-ModulesToImport 'RcLogUtil' `
-VisibleFunctions 'Out-LogToEventLog' `
-VisibleCmdlets 'Split-Path'
注册:
Register-PSSessionConfiguration -Path C:\Scripts\LoggerEp.pssc `
-Name loggerep `
-ShowSecurityDescriptorUI
并在我的本地机器上输入:
[W0216]> Enter-PSSession -ComputerName mka-ps-endpoint -ConfigurationName loggerep
Enter-PSSession : 处理模块时出现一个或多个错误 'RcLogUtil' 在用于创建的 InitialSessionState 对象中指定 这个运行空间。请参阅 ErrorRecords 属性以获取完整列表 错误。第一个错误是:无法识别术语“拆分路径” 作为 cmdlet、函数、脚本文件或可运行程序的名称。 检查名称的拼写,或者如果包含路径,请验证 路径正确,然后重试。在行:1 字符:1 + Enter-PSSession -ComputerName mka-ps-endpoint -ConfigurationName loggerep + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : OpenError: (:) [Enter-PSSession], RunspaceOpenModuleLoadException + FullyQualifiedErrorId : ErrorLoadingModulesOnRunspaceOpen
现在最大的问题是.. 为什么 Session 无法找到 Split-Path?或者我如何告诉端点加载那个特定的 cmdlet?
我用 SessionType='Default' 成功地尝试了同样的方法,它可以工作,但是周围有所有的 powershell 混乱。
我真的很感激我能得到的任何帮助,因为我已经坚持了很长一段时间了..
谢谢!
【问题讨论】:
标签: powershell scripting powershell-remoting endpoints