`Remove-DbaAgentJob` - `nvarchar` `-Job` Support & Consider `PurgeHistory` / `Drop` Methods

未关闭 适合新手
#10,871 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 2 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
65/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
powershell, sql
领域
database

调研方向

问题出在 public/Remove-DbaAgentJob.ps1 中,第 141 行左右把作业名传给 @job_name 参数时没有加 N 前缀,所以 Unicode 名称会失败。先按 issue 中的 New-DbaAgentJob 和 Remove-DbaAgentJob 管道复现,然后检查该 SQL 字符串中名称是如何加引号的。当带 Unicode 名称的作业能够无错误删除时即完成。PurgeHistory 和 Drop 的 API 构想是另一个规模更大的设计问题。

由索引模型根据 Issue 内容生成。

描述

bugs life triage required
Verified issue does not already exist?

I have searched and found no existing issue

What error did you receive?

No error. Simplest fix is to use an N'' string on @job_name parameter.
https://github.com/dataplat/dbatools/blob/f60caabe92c95a1baa0bd35c1ed546dfa4b345ff/public/Remove-DbaAgentJob.ps1#L141

I'd encourage moving to use api on Job with PurgeHistory and Drop ( with keepUnusedSchedule param ).

Steps to Reproduce
#Requires -Version 6
New-DbaAgentJob sqli -Job "t`u{02BC}" -Disabled -Description 'test unicode' | Remove-DbaAgentJob 
Please confirm that you are running the most recent version of dbatools

2.9.2

Other details or mentions

Depending on the change here, it could make #10870 irrelevant.

What PowerShell host was used when producing this error

PowerShell Core (pwsh.exe)

PowerShell Host Version

NA

SQL Server Edition and Build number

NA

.NET Framework Version

NA

主要语言
PowerShell
星标
2.9k
派生
869
平均合并
2 天 4 小时
30 天内合并 PR
38

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

dataplat/dbatools 的其他 Issue

查看 dataplat/dbatools 的全部 Issue

相似的 Issue

更多 Databases Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。