PowerShellExecutionPolicy doesn't allow multiple 'CurrentUser' assignments
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 35/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- powershell
调研方向
首先阅读现有的 PowerShellExecutionPolicy 资源,以及在 Windows PowerShell 5.1 上提供的 DSC 配置。定义凭据专用的 PowerShellUserExecutionPolicy 资源应如何支持多个 CurrentUser 赋值,然后验证单独的 Builder 和 Publisher 资源可以编译,而不会出现冲突重复错误。
由索引模型根据 Issue 内容生成。
描述
Problem description
Powershell 5.1 DSC doesn't allow you to specify the same ExecutionPolicy for ExecutionPolicyScope 'CurrentUser' but different PsRunAsCredentials, meaning you can't assign it to multiple specific users.
Verbose logs
Test-ConflictingResources : A conflict was detected between resources '[PowerShellExecutionPolicy]Builder (::8::5::PowerShellExecutionPolicy)' and '[PowerShellExecutionPolicy]Publisher
(::9::5::PowerShellExecutionPolicy)' in node 'localhost'. Resources have identical key properties but there are differences in the following non-key properties: 'PsDscRunAsCredential'.
Values 'System.Management.Automation.PSCredential' don't match values 'System.Management.Automation.PSCredential'. Please update these property values so that they are identical in both
cases.
At line:289 char:9
+ Test-ConflictingResources $keywordName $canonicalizedValue $k ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Write-Error], InvalidOperationException
+ FullyQualifiedErrorId : ConflictingDuplicateResource,Test-ConflictingResources
Compilation errors occurred while processing configuration 'FailSample'. Please review the errors reported in error stream and modify your configuration code appropriately.
At C:\Windows\system32\WindowsPowerShell\v1.0\Modules\PSDesiredStateConfiguration\PSDesiredStateConfiguration.psm1:3917 char:5
+ throw $ErrorRecord
+ ~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (FailSample:String) [], InvalidOperationException
+ FullyQualifiedErrorId : FailToProcessConfiguration
DSC configuration
{
Param([Parameter(Mandatory)][PSCredential]$Builder, [Parameter(Mandatory)][PSCredential]$Publisher)
Import-DscResource -ModuleName ComputerManagementDsc
Node localhost
{
PowerShellExecutionPolicy Builder { ExecutionPolicy='RemoteSigned'; ExecutionPolicyScope='CurrentUser'; PsDscRunAsCredential = $Builder }
PowerShellExecutionPolicy Publisher { ExecutionPolicy='RemoteSigned'; ExecutionPolicyScope='CurrentUser'; PsDscRunAsCredential = $Publisher }
}
}
Sample -Verbose -ConfigurationData:@{AllNodes=@(@{NodeName='localhost'; PsDscAllowPlainTextPassword=$true})}
Suggested solution
Add PowerShellUserExecutionPolicy which doesn't take scope and requires a credential.
PowerShellUserExecutionPolicy Builder
{
ExecutionPolicy = 'RemoteSigned' ; Credential = $builder
}
PowerShellUserExecutionPolicy Publisher
{
ExecutionPolicy = 'RemoteSigned' ; Credential = $publisher
}
Operating system the target node is running
OsName : Microsoft Windows 10 Pro
OsOperatingSystemSKU : 48
OsArchitecture : 64-bit
WindowsVersion : 2009
WindowsBuildLabEx : 19041.1.amd64fre.vb_release.191206-1406
OsLanguage : en-US
OsMuiLanguages : {en-US}
PowerShell version and build the target node is running
PSVersion 5.1.19041.1682
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.19041.1682
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
ComputerManagementDsc version
Name Version Path
---- ------- ----
ComputerManagementDsc 8.5.0 C:\Program Files\WindowsPowerShell\Modules\ComputerManagementDsc\8.5.0\ComputerManage
mentDsc.psd1
- 主要语言
- PowerShell
- 星标
- 338
- 派生
- 80
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
dsccommunity/ComputerManagementDsc 的其他 Issue
-
chore
难度 2/5 1-3 小时 新手友好度 78/100
-
chore
难度 4/5 3-5 天 新手友好度 68/100
-
chore: Add Agentic AI development assets for GitHub Copilot可能已有人在做 @PlagueHO 于 111 天前认领。 未关闭chore
难度 4/5 3-5 天 新手友好度 64/100
-
难度 2/5 1-3 小时 新手友好度 55/100
-
Computer: AD object deletion before domain join issue可能已有人在做 @Daymarvi 于 114 天前认领。 未关闭
难度 4/5 3-5 天 新手友好度 35/100
查看 dsccommunity/ComputerManagementDsc 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 82/100
zerocracy/judges-action#2733 ·
维护者通常 8 天内回复
-
windows-latest CI red on master: #2605 bundle-patch test breaks under CRLF checkout (dsh.bundle.patch.yml missing from .gitattributes eol=lf)可能重新可做 关联的 PR 已关闭且未合并。 未关闭
难度 1/5 1 小时以内 新手友好度 72/100
ranxianglei/billion-context#2623 · 2 条评论 ·
维护者通常 1 天内回复
-
dependencies feature github_actions good first issue
难度 2/5 1-3 小时 新手友好度 62/100
wemake-services/wemake-django-template#3149 ·
维护者通常 1 天内回复
-
CI/CD
难度 2/5 1-3 小时 新手友好度 62/100
GiganticMinecraft/seichi-portal-frontend#1185 ·
维护者通常 1 天内回复
-
severity: low
难度 2/5 1-3 小时 新手友好度 70/100
luainkernel/lunatik#1848 ·
维护者通常 1 天内回复