DSC ResourceRepositoryShare凭据

时间:2019-04-02 22:44:52

标签: powershell dsc

创作机:加入域的工作站-Windows 10-ps v5.1

目标节点:工作组计算机-Windows Server Core 2016-ps v5.1

我为目标节点配置了lcm,如下所示:

$secpasswd = ConvertTo-SecureString “Pass1Word” -AsPlainText -Force
$mycreds = New-Object System.Management.Automation.PSCredential (“abc.local\TestUser”, $secpasswd)

[DSCLocalConfigurationManager()]
configuration SmbCredTest
{
Node $AllNodes.NodeName
{
    Settings
    {
        RefreshMode = 'Push'
        RefreshFrequencyMins = 30
        RebootNodeIfNeeded = $true
        ConfigurationID    = '16db7357-9083-4806-a80c-ebbaf4acd6c1'
    }

    ResourceRepositoryShare SmbResourceShare
    {
        SourcePath = '\\WIN-E0TRU6U11B1\DscSmbShare'
        Credential = $mycreds

    }
}
}

$ConfigurationData = @{
AllNodes = @(
    @{
        #the "*" means "all nodes named in ConfigData" so we don't have to repeat ourselves
        NodeName="localhost"
        PSDscAllowPlainTextPassword = $true
    })
}

工作组计算机能够ping域abc.local

共享\\WIN-E0TRU6U11B1\DscSmbShare在具有'abc.local \ testuser'权限的域成员上

当我运行引用模块xpsdesiredstateconfiguration的简单配置时

Configuration xMsiPackage_InstallPackageConfig
{
param
(
    [Parameter(Mandatory = $true)]
    [System.String]
    $ProductId,

    [Parameter(Mandatory = $true)]
    [System.String]
    $Path
)

Import-DscResource -ModuleName 'xPSDesiredStateConfiguration'

Node localhost
{
    xMsiPackage MsiPackage1
    {
        ProductId = $ProductId
        Path      = $Path
        Ensure    = 'Present'
    }
}
}

我收到以下错误:

The user name or password is incorrect Could not install module 
dependencies needed by the configuration"

很明显,目标节点上的dsc无法访问moduleshare。

似乎是凭证问题,但不完全相同。 我已经验证了测试用户的密码,并确认我可以从另一台工作组计算机访问域共享。

0 个答案:

没有答案