icn*_*vad 0 profile powershell powershell-remoting
我是否正确当我在远程服务器上有一个加载某些功能的配置文件时,这些功能应该在远程PSSession中可用?
我的测试没有成功,是否有一个特殊的技巧让这个工作?
我想在网络共享上引用文件夹,以便在单个源上提供所有功能.
将pssessions与默认会话配置一起使用时,不会运行任何配置文件脚本.如果您想预先配置会话(加载自定义功能,管理单元,模块...),添加配置文件脚本到一个新的sessionconfiguration.该注册-PSSessionConfiguration cmdlet创建并注册在本地计算机上一个新的会话配置.使用Get-PSSessionConfiguration查看现有会话配置.Get-PSSessionConfiguration和Register-PSSessionConfiguration都需要提升权限(使用"以管理员身份运行"选项启动PowerShell).
Register-PSSessionConfiguration -Name WithProfile -StartupScript $PsHome\Profile.ps1
Run Code Online (Sandbox Code Playgroud)
要使用此预配置会话,您可以键入:
Enter-PSSession -ComputerName $computername -ConfigurationName WithProfile
Run Code Online (Sandbox Code Playgroud)
(其中$ computername是您注册pssession配置的RemoteServer的主机名).
PowerShell远程处理的一个很好的来源是Powershell Remoting的管理员指南.
| 归档时间: |
|
| 查看次数: |
1872 次 |
| 最近记录: |