Windows PowerShell 的一些配置
本文最后更新于 2025年8月14日 星期四 10:55
Windows 服务
1 | |
作用 :将 Windows 服务 ssh-agent 的启动类型设置为开机自动启动。ssh-agent 负责管理 SSH 密钥的身份验证代理。
-StartupType Automatic 可选值包括:
- Automatic(自动启动)
- Manual(手动启动)
- Disabled(禁用服务)
执行策略配置
1 | |
其中 <PolicyName> 是以下之一:
Restricted(默认值,禁止运行任何脚本)AllSigned(只运行受信任发布者签名的脚本)RemoteSigned(本地脚本无限制,远程脚本需签名)Unrestricted(允许所有脚本运行,但会警告)Bypass(完全跳过安全检查)Undefined(移除当前作用域的策略)
其他重要参数:
-Scope:指定作用域(LocalMachine/CurrentUser/Process)-Force:跳过确认提示-WhatIf:模拟操作而不实际执行
历史记录
获取当前 PowerShell 会话的 命令历史记录保存路径 。
1 | |
会得到:C:\Users\Admin\AppData\Roaming\Microsoft\Windows\PowerShell\PSReadLine\ConsoleHost_history.txt。
Windows PowerShell 的一些配置
https://blog.gtbcamp.cn/article/powershell/