Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xADComputer: Exception When Setting ServicePrincipalNames to An Empty String #382

Closed
X-Guardian opened this issue Jun 18, 2019 · 0 comments · Fixed by #388
Closed

xADComputer: Exception When Setting ServicePrincipalNames to An Empty String #382

X-Guardian opened this issue Jun 18, 2019 · 0 comments · Fixed by #388
Labels
bug The issue is a bug.

Comments

@X-Guardian
Copy link
Contributor

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

An exception occurs when deploying an xADComputer resource that sets the ServicePrincipalNames to an empty string when the Computer currently has one or more values present in the property.

Verbose logs showing the problem

VERBOSE: [MSTEST01]:                            [] Starting consistency engine.
VERBOSE: [MSTEST01]:                            [] A pending configuration exists. DSC will process a set request on the pending configuration.
VERBOSE: [MSTEST01]: LCM:  [ Start  Resource ]  [[xADComputer]Contoso\ExampleComputer]
VERBOSE: [MSTEST01]: LCM:  [ Start  Test     ]  [[xADComputer]Contoso\ExampleComputer]
VERBOSE: [MSTEST01]:                            [[xADComputer]Contoso\ExampleComputer] Determining the current state of the computer account 'ExampleComputer'. (ADC0006)
VERBOSE: [MSTEST01]:                            [[xADComputer]Contoso\ExampleComputer] Retrieving the information about the computer account 'ExampleComputer' from Active Directory. (ADC0002)
VERBOSE: [MSTEST01]:                            [[xADComputer]Contoso\ExampleComputer] The computer account 'ExampleComputer' is present in Active Directory. (ADC0003)
Cannot bind argument to parameter 'ServicePrincipalNames' because it is an empty string.
    + CategoryInfo          : InvalidData: (:) [], CimException
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorEmptyStringNotAllowed,Test-ServicePrincipalNames
    + PSComputerName        : localhost
 
VERBOSE: [MSTEST01]:                            [[xADComputer]Contoso\ExampleComputer] The computer account 'ExampleComputer' is in the desired state. (ADC0011)
VERBOSE: [MSTEST01]: LCM:  [ End    Test     ]  [[xADComputer]Contoso\ExampleComputer]  in 5.7210 seconds.
The PowerShell DSC resource '[xADComputer]Contoso\ExampleComputer' with SourceInfo 'C:\Users\administrator.AD\Documents\WindowsPowerShell\xadcomputer.ps1::13::9::xADComputer' threw one or more 
non-terminating errors while running the Test-TargetResource functionality. These errors are logged to the ETW channel called Microsoft-Windows-DSC/Operational. Refer to this channel for more details.
    + CategoryInfo          : InvalidOperation: (:) [], CimException
    + FullyQualifiedErrorId : NonTerminatingErrorFromProvider
    + PSComputerName        : localhost

Suggested solution to the issue

In the 'Test-ServicePrincipalNames' function, add the AllowEmptyString attribute to the ServicePrincipalNames parameter.

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

New-ADComputer -Name 'ExampleComputer' -OtherAttributes @{ServicePrincipalName='spn/compa','spn/compb'}

Configuration xADComputer
{
    param ()

    Import-DscResource -Module xActiveDirectory

    Node localhost
    {
        xADComputer Contoso\ExampleComputer {
            Ensure                = 'Present'
            ComputerName          = "ExampleComputer"
            ServicePrincipalNames = ''
        }
    }
}

xADComputer -ConfigurationData
Publish-DscConfiguration xADComputer
Start-DscConfiguration -Wait -UseExisting -Verbose

The operating system the target node is running

OsName               : Microsoft Windows Server 2019 Standard Evaluation
OsOperatingSystemSKU : 79
OsArchitecture       : 64-bit
WindowsVersion       : 1809
WindowsBuildLabEx    : 17763.1.amd64fre.rs5_release.180914-1434
OsLanguage           : en-US
OsMuiLanguages       : {en-US}

Version and build of PowerShell the target node is running

Name                           Value
----                           -----
PSVersion                      5.1.17763.316
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.17763.316
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)

ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Manifest   2.26.0.0   xActiveDirectory
@johlju johlju added bug The issue is a bug. help wanted The issue is up for grabs for anyone in the community. labels Jun 18, 2019
johlju pushed a commit that referenced this issue Jun 23, 2019
- Changes to xADComputer
  - Fix ServicePrincipalNames property empty string exception (issue #382).
@johlju johlju removed the help wanted The issue is up for grabs for anyone in the community. label Jun 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug The issue is a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants