ComputerManagementDsc
ComputerManagementDsc copied to clipboard
xComputer Resource should not require the computer name to join a domain
xComputer Resource should not require the computer name to join a domain
This would be great. In my situation I have vCloud already sysprepping the machine before DSC is run so the computer name is already set. I would just like the xComputer resource to join the machine to the domain without requiring me to specify the computer name in the MOF.
I agree, however since it's the Key is cannot be null.
So please allow the value of 'LocalHost'. Then if the value is localhost, just use $ENV:ComputerName.
That way we can host configurations on the Pull server that are consumed by many nodes and this setting will allow it to be generic. Also this will be very easy to implement.
I also agree, i'm attempting to use partial configurations to join the machine to the domain and the requirement to specify the machine name is a problem. I did consider using "`$env:computername" but this falls foul of the ValidationScripts (both the regex and length).
I've created my own resource as a work around but would be nice to get it included in this resource.
I'll try and get onto this change next week unless someone else does it first.
#37 seems to address this issue.
Excellent, thanks to all involved.
The schema is still broken and requires a computer name. We should fix the schema. ComputerName should become newComputerName and not be the key.
The idea was that if you use the string 'Localhost' for the ComputerName, then you intend to join the domain with the current name of the computer. So the name will not be blank, you just need to update the documentation to specify the special word 'localhost' and the context that it is used.
The problem is you could still have a configuration that says to rename the machine to 'foo' then later to 'bar' and the configuration would never converge.
Got the same issue. This is a blocker for me when using DSC for a domain join when using Azure Automation (AA). This as AA has a different approach in terms of compiling the MOFs.
@kvaes This may solve your needs until the Microsoft module is sorted
@theonlyway thanks! Will look into that.
Wasn't this sorted in 1.7.0.0 - "The Name parameter resolves to $env:COMPUTERNAME when the value is localhost".
Just specify "localhost" as the name and it will use the current name.
@danielgatley Please read https://github.com/PowerShell/xComputerManagement/issues/29#issuecomment-227013512
I vote for this
I also vote for this
I believe this configuration is already valid:
Node localhost
{
Computer NewNameAndWorkgroup
{
Name = 'localhost'
WorkGroupName = 'ContosoWorkgroup'
}
However, as Travis points out, using Name
as the 'key' results in the following configuration being valid:
Node localhost
{
Computer NewNameAndWorkgroup
{
Name = 'Server01'
WorkGroupName = 'ContosoWorkgroup'
}
Computer AnotherNewNameAndWorkgroup
{
Name = 'Server02'
WorkGroupName = 'ContosoWorkgroup'
}
}
This will never converge. A principle of DSC is that we need to try and prevent configurations that will not result in convergence.
I believe the schema should become:
[ClassVersion("1.0.1.0"), FriendlyName("Computer")]
class DSC_Computer : OMI_BaseResource
{
[Key, Description("Specifies the resource is a single instance, the value must be 'Yes'"), ValueMap{"Yes"}, Values{"Yes"}] String IsSingleInstance;
[Write, Description("The desired computer name.")] String Name;
[Write, Description("The name of the domain to join.")] String DomainName;
[Write, Description("The distinguished name of the organizational unit that the computer account will be created in.")] String JoinOU;
[Write, Description("Credential to be used to join a domain."), EmbeddedInstance("MSFT_Credential")] String Credential;
[Write, Description("Credential to be used to leave a domain."), EmbeddedInstance("MSFT_Credential")] String UnjoinCredential;
[Write, Description("The name of the workgroup.")] String WorkGroupName;
[Write, Description("The value assigned here will be set as the local computer description.")] String Description;
[Write, Description("The Active Directory Domain Controller to use to join the domain")] String Server;
[Read, Description("A read-only property that specifies the organizational unit that the computer account is currently in.")] String CurrentOU;
};
Would gratefully take PRs for this one. I'm not sure when I'll get to it otherwise (5 years and counting :cry: - for that, I apologize).
Sidenote: We should add an Example showing the localhost
pattern.