首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >未能在LCM的元配置中存储SMB拉服务器的加密凭据(PS4.0)

未能在LCM的元配置中存储SMB拉服务器的加密凭据(PS4.0)
EN

Stack Overflow用户
提问于 2017-11-22 18:31:35
回答 1查看 115关注 0票数 0

我是DSC的新手,几天来我一直试图让我的元配置与SMB拉服务器一起工作,但没有效果。

上下文:

  • 目标节点是Win 2012 R2服务器,属于同一域的成员。
  • 我只能使用PS4.0
  • 我不能让SMB共享服务器上的每个人都有读取权限
  • 我不想有拉模式依赖于自定义模块的功能(只有基本的PS4.0安装)
  • 我的创作节点目前是我的测试目标节点。
  • 我试图使用New-SelfsignedCertificateEx.ps1,但无法在我的Windows 7上运行
  • 我使用在Windows 10上生成的带有请求的KUs和EKU的自签名证书
  • 我的元配置使用没有凭据的SMB共享(由测试目标节点本身承载/授予每个人读访问权)。

我一直在网上搜索,但只找到代码示例或有关证书传递给DSC资源的问题。我还没有找到一个PS4.0代码的例子,其中一个活动的PSCredential对象(从Get-Credential cmdlet中检索)被实时加密到一个元配置mof。

我尝试过转换许多示例(包括来自这里这里的示例),但是我无法加密我的凭据,而且每次都会收到那条众所周知的消息:

代码语言:javascript
复制
ConvertTo-MOFInstance : System.InvalidOperationException error processing property 'Credential' OF TYPE 'LocalConfigurationManager': Converting and 
storing encrypted passwords as plain text is not recommended. For more information on securing credentials in MOF file, please refer to MSDN blog: 
http://go.microsoft.com/fwlink/?LinkId=393729
At line:190 char:16
+     $aliasId = ConvertTo-MOFInstance $keywordName $canonicalizedValue
+                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Write-Error], InvalidOperationException
    + FullyQualifiedErrorId : FailToProcessProperty,ConvertTo-MOFInstance
Errors occurred while processing configuration 'MetaConfigurationForPull'.
At C:\Windows\system32\WindowsPowerShell\v1.0\Modules\PSDesiredStateConfiguration\PSDesiredStateConfiguration.psm1:2223 char:5
+     throw $errorRecord
+     ~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (MetaConfigurationForPull:String) [], InvalidOperationException
    + FullyQualifiedErrorId : FailToProcessConfiguration

这是我的密码:

代码语言:javascript
复制
# Getting credentials for filer connection (CIFS share for pulling MOF files)
$cred = Get-Credential -Message 'Provide credentials for CIFS share hosting configuration files:'

Configuration MetaConfigurationForPull {
    Param (
        [PSCredential] $Credential
    )

    LocalConfigurationManager {
        ConfigurationID = "f28a102c-71c9-43a1-abbb-a944ec7cb5cd";
        CertificateID = $AllNodes.Thumbprint;
        Credential = $Credential;
        RefreshMode = "PULL";
        RebootNodeIfNeeded = $false;
        DownloadManagerName = "DscFileDownloadManager";
        DownloadManagerCustomData = @{SourcePath = '\\smb_pull_server\smb_share\mofs\batch_server'};
    }
}

$ConfigData= @{ 
    AllNodes = @(     
            @{  
                # The name of the node we are describing
                NodeName = "localhost"

                # The path to the .cer file containing the
                # public key of the Encryption Certificate
                # used to encrypt credentials for this node
                CertificateFile = "D:\node_rdp_cert.cer"

                # The thumbprint of the Encryption Certificate
                # used to decrypt the credentials on target node
                Thumbprint = "d78334010df5dee5de1c7529e9419a4bb841e618"
            };
        );
    }

MetaConfigurationForPull -Credential $cred -ConfigurationData $ConfigData -Output "D:\meta\batch_server"

我还发现了那个职位,它谈到了在PS5.0上的一些回归,并且这个家伙说,在PS4.0上,他拥有一切,就像一种魅力。

,我是不是在上面的代码中遗漏了什么?

任何帮助都将不胜感激。

谢谢

EN

回答 1

Stack Overflow用户

发布于 2017-11-23 05:39:59

只要这只是一个测试环境,就可以添加:

代码语言:javascript
复制
PSDscAllowPlainTextPassword = $true

你的配置。

例子:这里.

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/47441677

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档