Powershell远程处理:使用Powershell远程配置文件中加载的功能吗?

编程入门 行业动态 更新时间:2024-10-24 21:20:26
本文介绍了Powershell远程处理:使用Powershell远程配置文件中加载的功能吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我是否正确,当我在配置了某些功能的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远程配置文件中加载的功能吗?

本文发布于:2023-11-12 07:23:32,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1580870.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:配置文件   加载   功能   Powershell

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!