Powershell 5.1 Powershell Remoting 登录脚本?

Powershell 5.1 Powershell Remoting 登录脚本?

是否存在与 ssh 登录脚本等效的机制,可以在进入远程 PSSession 时触发?

远程或交互地创建 PSDrive、强制执行设置等会很好。

答案1

我在该位置使用了一些脚本$psProfilePath来执行一些类似操作,例如在本地 Powershell 控制台中导入一些函数。我认为您也可以将其用于远程会话。

对于常规 Powershell 主机:

$psProfilePath\Microsoft.PowerShell_profile.ps1

对于 ISE Powershell 主机:

$psProfilePath\Microsoft.PowerShellISE_profile.ps1

相关内容