ComputerManagementDsc icon indicating copy to clipboard operation
ComputerManagementDsc copied to clipboard

"Options" in the Computer resource is missing in 8.5.0

Open gnuhow opened this issue 3 years ago • 3 comments

Problem description

The Wiki currently lists and "option" Field that is available, but it is not available in the actual module on PSGallery.

Wiki:

Computer

Parameters

Parameter Attribute DataType Description Allowed Values
Name Key String The desired computer name.  
DomainName Write String The name of the domain to join.  
JoinOU Write String The distinguished name of the organizational unit that the computer account will be created in.  
Credential Write PSCredential Credential to be used to join a domain.  
UnjoinCredential Write PSCredential Credential to be used to leave a domain.  
WorkGroupName Write String The name of the workgroup.  
Description Write String The value assigned here will be set as the local computer description.  
Server Write String The Active Directory Domain Controller to use to join the domain  
Options Write StringArray[] Specifies advanced options for the Add-Computer join operation AccountCreate, Win9XUpgrade, UnsecuredJoin, PasswordPass, JoinWithNewName, JoinReadOnly, InstallInvoke

Verbose logs

Powershell
PS C:\Caelus> Get-DscResource Computer

ImplementedAs   Name                      ModuleName                     Version    Properties
-------------   ----                      ----------                     -------    ----------
PowerShell      Computer                  ComputerManagementDsc          8.5.0      {Name, Credential, DependsOn, Description...}


PS C:\Caelus> Get-DscResource Computer -Syntax
Computer [String] #ResourceName
{
    Name = [string]
    [Credential = [PSCredential]]
    [DependsOn = [string[]]]
    [Description = [string]]
    [DomainName = [string]]
    [JoinOU = [string]]
    [PsDscRunAsCredential = [PSCredential]]
    [Server = [string]]
    [UnjoinCredential = [PSCredential]]
    [WorkGroupName = [string]]
}

DSC configuration

Computer join {
            Name = "$ServerName"
            DomainName = "$domain"
            JoinOU = "$ou"
            Credential = $cred
            Options = @("$opt1","$opt2")
}

Suggested solution

Please commit and push the "options" parameter to Computer.

Operating system the target node is running

Microsoft Windows Server 2019 Datacenter

PowerShell version and build the target node is running

5.1.17763.2931

ComputerManagementDsc version

8.5.0

gnuhow avatar Jul 15 '22 14:07 gnuhow

Looks like the "options" parameter is missing in my local code, but no on this Github. I think the file was not pushed to PSGallery in 8.5.0 somehow.

PS C:\Program Files\WindowsPowerShell\Modules\ComputerManagementDsc\8.5.0\DSCResources\DSC_Computer> gc .\DSC_Computer.psm1
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidGlobalVars', '', Scope = 'Function')]
param
(
)

$modulePath = Join-Path -Path (Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -Parent) -ChildPath 'Modules'

# Import the ComputerManagementDsc Common Modules
Import-Module -Name (Join-Path -Path $modulePath `
        -ChildPath (Join-Path -Path 'ComputerManagementDsc.Common' `
            -ChildPath 'ComputerManagementDsc.Common.psm1'))

Import-Module -Name (Join-Path -Path $modulePath -ChildPath 'DscResource.Common')

# Import Localization Strings
$script:localizedData = Get-LocalizedData -DefaultUICulture 'en-US'

$FailToRenameAfterJoinDomainErrorId = 'FailToRenameAfterJoinDomain,Microsoft.PowerShell.Commands.AddComputerCommand'

<#
    .SYNOPSIS
        Gets the current state of the computer.

    .PARAMETER Name
        The desired computer name.

    .PARAMETER DomainName
        The name of the domain to join.

    .PARAMETER JoinOU
        The distinguished name of the organizational unit that the computer
        account will be created in.

    .PARAMETER Credential
        Credential to be used to join a domain.

    .PARAMETER UnjoinCredential
        Credential to be used to leave a domain.

    .PARAMETER WorkGroupName
        The name of the workgroup.

    .PARAMETER Description
        The value assigned here will be set as the local computer description.

    .PARAMETER Server
        The Active Directory Domain Controller to use to join the domain.
#>

gnuhow avatar Jul 15 '22 14:07 gnuhow

You have to use the latest preview version on the Gallery. The wiki always reflect the latest release, preview or full release.

johlju avatar Jul 16 '22 14:07 johlju

On the wiki Home it shows what the latest release is, in this case ComputerManagementDsc v8.6.0-preview0002.

johlju avatar Jul 16 '22 14:07 johlju