我是否正确,当我在配置了某些功能的RemoteServer上具有配置文件时,这些功能应该在Remote PSSession中可用吗?
Do i get it right that when i have a Profile on a RemoteServer which loads some functions, these functions should be available in a Remote PSSession?
我的测试未成功,是否有特殊的技巧可以使它正常工作?
My tests weren't successfull, is there a special trick to get this working?
我想参考网络共享上的文件夹,以使单个来源上的所有功能都可用.
I want to refer to Folder on a network share to have all Functions on a single source available.
推荐答案在默认会话配置中使用pssessions时,不会运行任何配置文件脚本.如果要预配置会话(以加载自定义功能,管理单元,模块...),请向新的 sessionconfiguration 添加配置文件脚本. Register-PSSessionConfiguration cmdlet在本地创建并注册新的会话配置电脑.使用 Get-PSSessionConfiguration 查看现有的会话配置. Get-PSSessionConfiguration和Register-PSSessionConfiguration都需要提升的权限(使用以管理员身份运行"选项启动PowerShell).
When you use pssessions with the default session configurations, no profile scripts run. If you want a session to be preconfigured (to load custom functions, snap-ins, modules ...), add a profile script to a new sessionconfiguration. The Register-PSSessionConfiguration cmdlet creates and registers a new session configuration on the local computer. Use Get-PSSessionConfiguration to view existing session configurations. Both Get-PSSessionConfiguration and Register-PSSessionConfiguration require elevated rights (start PowerShell with the "Run as Administrator" option).
Register-PSSessionConfiguration -Name WithProfile -StartupScript $PsHome\Profile.ps1要使用此预配置的会话,请输入:
To use this preconfigured session you would type:
Enter-PSSession -ComputerName $computername -ConfigurationName WithProfile(其中$ computername是您注册pssessionconfiguration的RemoteServer的主机名).
(where $computername is the hostname of RemoteServer where you registered the pssessionconfiguration).
《 Powershell Remoting管理员指南》 是有关Powershell Remoting的一个很好的资料.
A good source on powershell remoting is the Administrator's Guide to Powershell Remoting.
更多推荐
Powershell远程处理:使用Powershell远程配置文件中加载的功能吗?
发布评论