Skip to content
This repository has been archived by the owner on Jun 14, 2024. It is now read-only.

Group: Can't create a Group and add a new user to it #182

Open
NemoDima opened this issue Mar 18, 2020 · 2 comments
Open

Group: Can't create a Group and add a new user to it #182

NemoDima opened this issue Mar 18, 2020 · 2 comments
Labels
question The issue is a question.

Comments

@NemoDima
Copy link

NemoDima commented Mar 18, 2020

Details of the scenario you tried and the problem that is occurring

Try to create a group and add a new user to it

Verbose logs showing the problem

VERBOSE: Perform operation 'Invoke CimMethod' with following parameters, ''methodName' = SendConfigurationApply,'className' = MSFT_DSC
LocalConfigurationManager,'namespaceName' = root/Microsoft/Windows/DesiredStateConfiguration'.
VERBOSE: An LCM method call arrived from computer WIN-625BDGBIE5Q with user sid S-1-5-21-1433097689-3504384152-1439987464-1002.
VERBOSE: [WIN-625BDGBIE5Q]: LCM:  [ Start  Set      ]
VERBOSE: [WIN-625BDGBIE5Q]: LCM:  [ Start  Resource ]  [[User]UserExample]
VERBOSE: [WIN-625BDGBIE5Q]: LCM:  [ Start  Test     ]  [[User]UserExample]
VERBOSE: [WIN-625BDGBIE5Q]:                            [[User]UserExample] A user with the name FtpBackup exists.
VERBOSE: [WIN-625BDGBIE5Q]:                            [[User]UserExample] All User FtpBackup properties match.
VERBOSE: [WIN-625BDGBIE5Q]: LCM:  [ End    Test     ]  [[User]UserExample]  in 2.3790 seconds.
VERBOSE: [WIN-625BDGBIE5Q]: LCM:  [ Skip   Set      ]  [[User]UserExample]
VERBOSE: [WIN-625BDGBIE5Q]: LCM:  [ End    Resource ]  [[User]UserExample]
VERBOSE: [WIN-625BDGBIE5Q]: LCM:  [ Start  Resource ]  [[Group]FTPBackup]
VERBOSE: [WIN-625BDGBIE5Q]: LCM:  [ Start  Test     ]  [[Group]FTPBackup]
Exception calling "FindByIdentity" with "2" argument(s): "The specified local group does not exist.
"
    + CategoryInfo          : NotSpecified: (:) [], CimException
    + FullyQualifiedErrorId : PrincipalOperationException,GetGroup
    + PSComputerName        : localhost
 
VERBOSE: [WIN-625BDGBIE5Q]: LCM:  [ End    Test     ]  [[Group]FTPBackup]  in 2.5470 seconds.
The PowerShell DSC resource '[Group]FTPBackup' with SourceInfo '::21::9::Group' threw one or more non-terminating errors while runnin
g the Test-TargetResource functionality. These errors are logged to the ETW channel called Microsoft-Windows-DSC/Operational. Refer t
o this channel for more details.
    + CategoryInfo          : InvalidOperation: (:) [], CimException
    + FullyQualifiedErrorId : NonTerminatingErrorFromProvider
    + PSComputerName        : localhost
 
VERBOSE: [WIN-625BDGBIE5Q]: LCM:  [ End    Set      ]
The SendConfigurationApply function did not succeed.
    + CategoryInfo          : NotSpecified: (root/Microsoft/...gurationManager:String) [], CimException
    + FullyQualifiedErrorId : MI RESULT 1
    + PSComputerName        : localhost
 
VERBOSE: Operation 'Invoke CimMethod' complete.
VERBOSE: Time taken for configuration job to complete is 5.568 seconds

The DSC configuration that is used to reproduce the issue (as detailed as possible)

Configuration Basic_settings
{
    Import-DscResource -ModuleName PSDesiredStateConfiguration

    Node "localhost"
    {
        $FTPpassword = "ForB1" | ConvertTo-SecureString -asPlainText -Force
        $FTPusername = "FtpBackup"
        [PSCredential] $FTPcredential = New-Object System.Management.Automation.PSCredential($FTPusername,$FTPpassword)
                
        User UserExample
        {
            Ensure = "Present"  # To ensure the user account does not exist, set Ensure to "Absent"
            UserName = "FtpBackup"
            FullName = "FtpBackup"
            Description = "GoodStream"
            Password = $FTPcredential # This needs to be a credential object
            PasswordNeverExpires = $true
        }

        Group FTPBackup 
        {
            GroupName        = 'FTPBackup'
            Ensure           = 'Present'
            MembersToInclude = 'FtpBackup'
            DependsOn = '[User]UserExample'
        }
    }
}

$configData = @{
    AllNodes = @(
        @{
            NodeName = '*'
            PSDscAllowPlainTextPassword = $True
            PsDscAllowDomainUser = $true   
        }
        @{
            NodeName = 'localhost'
            PSDscAllowPlainTextPassword = $True
            PsDscAllowDomainUser = $true   
        }
    )
}

Basic_settings -OutputPath "C:\DSC\Configurations" -ConfigurationData $configData
Start-DscConfiguration -Wait -Verbose -Path "C:\DSC\Configurations" -Force

The operating system the target node is running

OsName : Microsoft Windows Server 2016 Datacenter
OsOperatingSystemSKU : DatacenterServerEdition
OsArchitecture : 64-bit
WindowsBuildLabEx : 14393.1794.amd64fre.rs1_release.171008-1615
OsLanguage : en-US
OsMuiLanguages : {en-US}

Windows is launched under VMware® Workstation 15 Pro 15.1.0 build-13591040

Version and build of PowerShell the target node is running

PSVersion 5.1.14393.1884
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.14393.1884
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

Version of the DSC module that was used ('dev' if using current dev branch)

? master current 2.12.0.0-PSGallery

@NemoDima NemoDima changed the title ResourceName: Can't create a Group and add a new user to it Group: Can't create a Group and add a new user to it Mar 18, 2020
@PlagueHO
Copy link
Contributor

PlagueHO commented Apr 2, 2020

Hi @NemoDima,

I've just noticed that the resource your config is using the Group resource in the inbox PSDesiredStateConfiguration resource module. Those are the ones that come with Windows and are much older than this one. Can you instead use the Group resource in this module: PSDscResources

PSDscResources is a replacement for the Inbox resources. It is supported. There is also a community version of this module (xPSDesiredStateConfiguration) that would also work but may differ in function from the PSDscResources module.

@PlagueHO PlagueHO added the question The issue is a question. label Apr 2, 2020
@General-Fault
Copy link

I've run into this with the PSDscResources Group resource.

ConfigurationName    : TestConfiguration
DependsOn            : 
ModuleName           : PSDscResources
ModuleVersion        : 2.10.0.0
PsDscRunAsCredential : 
ResourceId           : [Group]CreateDBUsersGroup
SourceInfo           : \\ast-deploy.asteres.local\Configuration\Source\TestConfiguration.ps1::140::5::Group
DurationInSeconds    : 2.641
Error                : {
                           "Exception":  {
                                             "Message":  "PowerShell DSC resource MSFT_GroupResource  failed to execute Test-TargetResource functionality with error message: Exception calling \".ctor\" with \"2\" argument(s): \"Server names cannot contain a space 
                       character.\" ",

This appears to be related to dsccommunity/xPSDesiredStateConfiguration#180

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
question The issue is a question.
Projects
None yet
Development

No branches or pull requests

3 participants