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

"Options" in the Computer resource is missing in 8.5.0 #390

Closed
gnuhow opened this issue Jul 15, 2022 · 5 comments
Closed

"Options" in the Computer resource is missing in 8.5.0 #390

gnuhow opened this issue Jul 15, 2022 · 5 comments

Comments

@gnuhow
Copy link

gnuhow commented Jul 15, 2022

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
Copy link
Author

gnuhow commented Jul 15, 2022

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.
#>

@johlju
Copy link
Member

johlju commented Jul 16, 2022

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

@johlju
Copy link
Member

johlju commented Jul 16, 2022

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

@Borgquite
Copy link
Contributor

@johlju Time to close this one?

@johlju
Copy link
Member

johlju commented Oct 7, 2024

Yes, thanks.

@johlju johlju closed this as completed Oct 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants