X Twitter Poster
通过连接已登录 Chrome 浏览器,自动发送 X 推文,支持跨平台快捷键。
下载 42
针对 Windows 系统的脚本安全、静默失败排查与运维最佳实践。
openclaw skills install @ivangdavila/windows命令、参数、文件名以原文为准
# 存储凭证
cmdkey /generic:"MyService" /user:"admin" /pass:"secret"
# 在脚本中检索
$cred = Get-StoredCredential -Target "MyService"Get-Credential 并安全导出: $cred | Export-Clixml -Path "cred.xml" # 加密保存至当前用户/机器
$cred = Import-Clixml -Path "cred.xml"gpresult /r 查看实际应用的策略-ErrorAction SilentlyContinue 会隐藏错误 — 应使用 Stop 并显式处理异常SeCreateSymbolicLinkPrivilege 权限 — 普通用户会静默失败mklink 仅适用于 CMD,PowerShell 中使用 New-Item -ItemType SymbolicLink $cert = Get-ChildItem Cert:\CurrentUser\My -CodeSigningCert
Set-AuthenticodeSignature -FilePath script.ps1 -Certificate $cert-WhatIf 测试 — 如 Remove-Item -Recurse -WhatIfStart-Transcript 记录操作日志 — 容易遗忘,直到事故调查时才意识到缺失icacls 进行命令行操作,但继承规则不直观 — 建议先在副本上测试更改Enable-PSRemoting -Force 在工作组环境中仍不足Set-Item WSMan:\localhost\Client\TrustedHosts -Value "server1,server2" New-EventLog -LogName Application -Source "MyScript" -ErrorAction SilentlyContinue
Write-EventLog -LogName Application -Source "MyScript" -EventId 1000 -Message "Started" try { [IO.File]::OpenWrite($path).Close(); $true } catch { $false }$env:TEMP 会无声填满磁盘空间 — 脚本应使用 try/finally 确保清理: $tmp = New-TemporaryFile
try { ... } finally { Remove-Item $tmp -Force }/tmp 不同,不会自动清理$env:USERPROFILE 指向系统配置文件,而非用户个人目录\\server\share已收录 13 个 Skill