gpt4 book ai didi

windows - 获取代表本地系统内置帐户的 PSCredential 实例

转载 作者:可可西里 更新时间:2023-11-01 13:34:01 26 4
gpt4 key购买 nike

在 Windows 10 Build 10240 上运行 PowerShell 5.0 版。我需要获取包含 LocalSystem 上下文的 PSCredential 实例。我怎样才能做到这一点?

https://msdn.microsoft.com/en-us/library/windows/desktop/ms684190(v=vs.85).aspx

最佳答案

来自您链接到的文档:

This account does not have a password. If you specify the LocalSystem account in a call to the CreateService or ChangeServiceConfig function, any password information you provide is ignored.

因此,只需在 pscredential 构造函数中提供“任何密码信息”:

$Username = "NT AUTHORITY\SYSTEM"
$Password = "whatever you feel like" | ConvertTo-SecureString -AsPlainText -Force
$LocalSystemCreds = New-Object -TypeName pscredential -ArgumentList $Username,$Password

关于windows - 获取代表本地系统内置帐户的 PSCredential 实例,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31568981/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com