dsccommunity / xdhcpserver Goto Github PK
View Code? Open in Web Editor NEWThis module contains DSC resources for deployment and configuration of Microsoft DHCP Server.
License: MIT License
This module contains DSC resources for deployment and configuration of Microsoft DHCP Server.
License: MIT License
$dhcpOption = Get-DhcpServerv4OptionValue -ScopeID $ScopeID
never returns empty. According to technet article if not specified default Lease Duration for a scope will be 8 days.
Because of this Option 51 Lease Duration is always present in new scopes and ValidateResourceProperties always finds DHCP option so this part of code is never reached.
And this is called when it should not be called and as a side effect removes Lease Duration option and sets lease time to 0:0:0.
foreach($option in $dhcpOption.OptionID)
{
Remove-DhcpServerv4OptionValue -ScopeId $ScopeID -OptionId $option
}
I've tested this behavior on freshly deployed 2012 R2 with lates xDhcpServer from PSGallery.
Is there a plan to support configuring DHCP server options as opposed to scope options?
NewResourceName: DhcpServerDnsDynamicUpdates
Set DHCP to update DNS Dynamically and Delete DNS Resource Records when lease expires
(e.g. 'Set-DhcpServerv4DnsSetting -Computername "" -DynamicUpdates "Always" -DeleteDnsRRonLeaseExpiry $True')
xDhcpServerDnsDynamicUpdates
Ensure: 'Present'
EnableDnsDynamicUpdates: 'Always, Never, Requested'
DiscardDhcpRR: 'Enabled/Disabled' or 'True/False'
DynamicUpdateDnsRRRequest: 'Enabled/Disabled' or 'True/False'
Resource to control the behavior of Dhcp server NIC bindings. By default all nics are bound to the dhcp service but this is not always the desired state.
InterfaceAlias, Ensure
n/a
The term 'IPAddress' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included,
verify that the path is correct and try again.
+ CategoryInfo : ObjectNotFound: (IPAddress:) [], CimException
+ FullyQualifiedErrorId : CommandNotFoundException,Microsoft.PowerShell.Commands.WhereObjectCommand
+ PSComputerName : AD_Server
The PowerShell DSC resource '[xDhcpServerReservation]TEST_Reservation' with SourceInfo 'D:\Documents\WindowsPowerShell\DSC\HQ\AD_Server.ps1::240::9::xDhcpServerReservation'
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: (root/Microsoft/...gurationManager:String) [], CimException
+ FullyQualifiedErrorId : NonTerminatingErrorFromProvider
+ PSComputerName : AD_Server
Error Event Logs from impacted server:
TimeCreated : 1/6/2021 8:09:16 PM
ProviderName : Microsoft-Windows-DSC
Id : 4252
Message : Job {0DB3D577-509E-11EB-AAB2-0050568C05D3} : MIResult: 1 Error Message: The PowerShell DSC resource '[xDhcpServerReservation]DHCPReservationPrinter-Door1' with SourceInfo 'D:\Documents\WindowsPowerShell\DSC\HQ\HQ-AD01.ps1::243::13::xDhcpServerReservation' 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.
Message ID: NonTerminatingErrorFromProvider
Error Category: 7
Error Code: 1
Error Type: MI
TimeCreated : 1/6/2021 8:09:16 PM
ProviderName : Microsoft-Windows-DSC
Id : 4252
Message : Job {0DB3D577-509E-11EB-AAB2-0050568C05D3} :
MIResult: 1
Error Message: The term 'IPAddress' is not recognized as the name of a cmdlet, function, script file,
or operable program. Check the spelling of the name, or if a path was included, verify that the path is
correct and try again.
Message ID: CommandNotFoundException,Microsoft.PowerShell.Commands.WhereObjectCommand
Error Category: 13
Error Code: 13
Error Type: MI
TimeCreated : 1/6/2021 8:09:16 PM
ProviderName : Microsoft-Windows-DSC
Id : 4103
Message : Job {0DB3D577-509E-11EB-AAB2-0050568C05D3} :
This event indicates that a non-terminating error was thrown when DSCEngine was executing
Test-TargetResource on MSFT_xDhcpServerReservation DSC resource. FullyQualifiedErrorId is
CommandNotFoundException,Microsoft.PowerShell.Commands.WhereObjectCommand. Error Message is The term
'IPAddress' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try
again..
VERBOSE: [AD_Server]: LCM: [ Start Resource ] [[xDhcpServerReservation]TEST_Reservation]
VERBOSE: [AD_Server]: LCM: [ Start Test ] [[xDhcpServerReservation]TEST_Reservation]
VERBOSE: [AD_Server]: [[xDhcpServerReservation]TEST_Reservation] Evaluating the server reservation with scope id '172.16.15.0' if it is in the
desired state.
VERBOSE: [AD_Server]: [[xDhcpServerReservation]TEST_Reservation] Checking DHCP server reservation in scope id 172.16.15.0 for IP address 172.16.0.49
...
The term 'IPAddress' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included,
verify that the path is correct and try again.
+ CategoryInfo : ObjectNotFound: (IPAddress:) [], CimException
+ FullyQualifiedErrorId : CommandNotFoundException,Microsoft.PowerShell.Commands.WhereObjectCommand
+ PSComputerName : AD_Server
VERBOSE: [AD_Server]: [[xDhcpServerReservation]TEST_Reservation] DHCP server reservation in the given scope id for the IP address is absent and it
should be Present
VERBOSE: [AD_Server]: LCM: [ End Test ] [[xDhcpServerReservation]TEST_Reservation] False in 0.4220 seconds.
VERBOSE: [AD_Server]: LCM: [ FAILEDCompare ] Completed processing compare operation. The operation returned False.
The PowerShell DSC resource '[xDhcpServerReservation]TEST_Reservation' with SourceInfo 'D:\Documents\WindowsPowerShell\DSC\HQ\AD_Server.ps1::240::9::xDhcpServerReservation'
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: (root/Microsoft/...gurationManager:String) [], CimException
+ FullyQualifiedErrorId : NonTerminatingErrorFromProvider
+ PSComputerName : AD_Server
VERBOSE: Operation 'Invoke CimMethod' complete.
VERBOSE: Time taken for configuration job to complete is 21.126 seconds
N/A
xDhcpServerReservation "TEST_Reservation" {
Ensure = 'Present'
Name = 'Printer-Door1'
ScopeID = '172.16.15.0'
IPAddress = '172.16.15.49'
ClientMACAddress = '001122334455'
AddressFamily = 'IPv4'
DependsOn = "[xDHCpServerScope]Add-DhcpScope"
}
OsName : Microsoft Windows Server 2019 Standard
OsOperatingSystemSKU : StandardServerEdition
OsArchitecture : 64-bit
WindowsVersion : 1809
WindowsBuildLabEx : 17763.1.amd64fre.rs5_release.180914-1434
OsLanguage : en-US
OsMuiLanguages : {en-US}
Name Value
PSVersion 5.1.17763.1007
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.17763.1007
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
3.0.0-Preview2
The router variable is not documented on the main README.md file as to its purpose.
Hi Team, at the moment the xDhcpServer resource cannot create a functioning DHCP server because authorization is required for the DHCP server to start serving DHCP requests. As a work around I've created a script resource. It would be nice if xDhcpServer could authorize as well.
Script AuthorizeDHCPServer
{
DependsOn = '[Service]DHCPService'
PsDscRunAsCredential = $Credential
GetScript = {
@{
GetScript = $GetScript
SetScript = $SetScript
TestScript = $TestScript
Result = $null -ne (Get-DhcpServerInDC | Where-Object -FilterScript {$PSItem.DnsName -like "$($Using:Node.NodeName)*"})
}
}
SetScript = {
Add-DhcpServerInDC -DnsName "$($Using:Node.NodeName).$($Using:FQDN)"
}
TestScript = {
$Status = $null -ne (Get-DhcpServerInDC | Where-Object -FilterScript {$PSItem.DnsName -like "$($Using:Node.NodeName)*"})
$Status -eq $True
}
}
No matter what you specify (single string, string array) you get the error
The variable cannot be validated because the value System.String[] is not a valid value for the Router variable.
# insert configuration here
Work need to be done to convert this repository to use the new CI pipeline.
https://dsccommunity.org/blog/convert-a-module-for-continuous-delivery/
Basically i tested to create new exclusion range which works ok
Running the same configuration also works fine as expected - idempotency is ok
Problem is when I change the parameter of the exclusion range, i get fatal error of the module
Seems that module is not able to deal with this scenario
Then i thought OK lets delete all ranges from the range and re-run the code with new parameters
Here i bumped into another issue.
This module requires Start and End IP which makes sense.
Problem is that i dont have a way to get information about existing ranges from any DSC module. That means i have create extra code to grab the exclusions and feed it to the module with parameter absent
Would be great to NOT have Start and End IP mandatory when ABSENT is selected. That way the module simply delete all Exclusion ranges
I know its bit tricky issue with changing the exclusion, maybe you have some idea how to enhance it ?
# insert configuration here
Router property is not added to Get-TargetResource output hashtable so it is empty in Get-DscConfigration output even when it was set:
place in code
@{
ScopeID = $ScopeID
DnsDomain = $dnsDomain
AddressFamily = 'IPv4'
Ensure = $ensure
DnsServerIPAddress = $dnsServerIP
}
To support automatic wiki documentation and conceptual help a resource README.md should be added for each resource.
See example here https://github.com/dsccommunity/ComputerManagementDsc/tree/master/source/DSCResources/DSC_Computer
Can someone tell me if it's possible to set this non-option setting? I see there's some sort of test for the set-dhcpserversetting, but I don't see that it maps to one of the DSC commands.
After setting up a DHCP server the Server Manager is still complain about configuration is needed.
This can apparently be solved by change a registry entry mentioned in the section Notify Server Manager that post-install DHCP configuration is complete (Optional).
Default after installation it is
PS > (Get-ItemProperty –Path registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ServerManager\Roles\12 -Name ConfigurationState).ConfigurationState
1
It seems that the Router
option of xDhcpServerOption
must always be set? Is there any way to leave it unspecified? If I leave it unspecified I get the following error:
The variable cannot be validated because the value System.String[] is not a valid value for the Router variable.
+ CategoryInfo : MetadataError: (:) [], CimException
+ FullyQualifiedErrorId : ValidateSetFailure
+ PSComputerName : localhost
If I set Lease Duration to '02:00:00' then on the DHCP server that translates to
"Days: 0 Hours: 2 Minutes: 0"
If I set Lease Duration to '48:00:00' then on the DHCP server that translates to
Days: 48 Hours: 0 Minutes: 0
I tried to use xDhcpScope in production and while testing different scenarios I noticed that key properties for that resource are IPStartRange and IPEndRange.
In my opinion it would be far better to use ScopeId as a key property - it should also help simplifying the code and making most of the properties of the scope write-able. Get-DhcpServerv4Scope
allows user to specify ScopeId to limit the results, so with that property as a key validating presence/properties should be easier and more efficient.
I do realize that it would be a serious breaking change, but I believe it's a necessary one.
Hi folks, just to let yo know, I need to setup dhcp vendor classes on 1500 server across 22 states. I'm working on a resource called xdhcpServerClass to accomplish this.
Right now it's already working, I just need to create some pester tests so I can create a pull request.
DnsServerIPAddress is mandatory, but could be provided some other way
Reported in Slack,
"the xDhcpServerOption dsc resource, you can't set the default gateway'
The current resource does not have the option of setting a Default Value for the option definition. I think this should be added as an optional parameter.
[string]DefaultValue
String is the parameter type defined in the underlying command.
https://docs.microsoft.com/en-us/powershell/module/dhcpserver/set-dhcpserverv4optiondefinition?view=win10-ps
Support for Add-DhcpServerSecurityGroup would be nice to have, so as to create the DHCP Administrators and the DHCP Users groups. This is easily worked around with a script resource, but it would be nice to be included in this Resource Module.
Hello folks, just to let you know, I'm working on a new resource: xDhcpServerOptionDefinition.
When converting the repo in issue #59 the code coverage did not measure up to the default threshold of 85 percent. Once more tests have been added (moving towards HQRM) the threshold should be raised in the build.yaml
.
Trying to setup DHCP options for Skype VoIP. Using chef with dsc resources.
dsc_resource 'OptionDef120' do
resource :xDhcpServerOptionDefinition
module_name 'xDhcpServer'
property :Ensure, 'Present'
property :Name, 'UCSipServer'
property :OptionID, 120
property :Type, 'BinaryData'
property :Description, 'Sip Server Fqdn'
property :VendorClass, ''
property :AddressFamily, 'IPv4'
end
dsc_resource 'OptionValue120' do
resource :DhcpServerOptionValue
module_name 'xDhcpServer'
property :Ensure, 'Present'
property :OptionID, 120
property :Value, ['000963696F2D7563706C31056F73756164036F73750365647500']
property :VendorClass, ''
property :AddressFamily, 'IPv4'
end
First run:
================================================================================
Error executing action run
on resource 'dsc_resource[OptionValue120]'
================================================================================
Chef::Exceptions::PowershellCmdletException
-------------------------------------------
PowerShell Cmdlet failed: Could not find mandatory property UserClass. Add this property and try again.
+ CategoryInfo : ObjectNotFound: (root/Microsoft/...gurationManager:String) [], CimException
+ FullyQualifiedErrorId : MI RESULT 6
+ PSComputerName : localhost
Resource Declaration:
---------------------
# In c:/chef/cache/cookbooks/fisher-role-dhcp-windows/recipes/default.rb
170: dsc_resource 'OptionValue120' do
171: resource :DhcpServerOptionValue
172: module_name 'xDhcpServer'
173: property :Ensure, 'Present'
174: property :OptionID, 120
175: property :Value, ['000963696F2D7563706C31056F73756164036F73750365647500']
176: property :VendorClass, ''
177: property :AddressFamily, 'IPv4'
178: end
179:
Compiled Resource:
------------------
# Declared in c:/chef/cache/cookbooks/fisher-role-dhcp-windows/recipes/default.rb:170:in `from_file'
dsc_resource("OptionValue120") do
action [:run]
default_guard_interpreter :default
properties {Ensure=>"Present", OptionID=>120, Value=>["000963696F2D7563706C31056F73756164036F73750365647500"], VendorClass=>"", AddressFamily=>"IPv4"}
resource :DhcpServerOptionValue
declared_type :dsc_resource
cookbook_name "fisher-role-dhcp-windows"
recipe_name "default"
module_name "xDhcpServer"
end
System Info:
------------
chef_version=14.13.11
platform=windows
platform_version=10.0.17763
ruby=ruby 2.5.5p157 (2019-03-15 revision 67260) [x64-mingw32]
program_name=C:/opscode/chef/bin/chef-client
executable=C:/opscode/chef/bin/chef-client
After adding UserClass property:
================================================================================
Error executing action run
on resource 'dsc_resource[OptionValue120]'
================================================================================
Chef::Exceptions::PowershellCmdletException
-------------------------------------------
PowerShell Cmdlet failed: Parameters for option value to be set for option ID 120 do not match with option definition on DHCP server DHCPSEC.
+ CategoryInfo : InvalidArgument: (120:) [], CimException
+ FullyQualifiedErrorId : WIN32 87,Set-DhcpServerv4OptionValue
+ PSComputerName : localhost
The PowerShell DSC resource '[DhcpServerOptionValue]DirectResourceAccess' with SourceInfo '' threw one or more non-terminating errors while running the Set-TargetResource functionality. These errors are logged to the ETW channel called
Microsoft-Windows-DSC/Operational. Refer to this channel for more details.
+ CategoryInfo : InvalidOperation: (root/Microsoft/...gurationManager:String) [], CimException
+ FullyQualifiedErrorId : NonTerminatingErrorFromProvider
+ PSComputerName : localhost
Resource Declaration:
---------------------
# In c:/chef/cache/cookbooks/fisher-role-dhcp-windows/recipes/default.rb
170: dsc_resource 'OptionValue120' do
171: resource :DhcpServerOptionValue
172: module_name 'xDhcpServer'
173: property :Ensure, 'Present'
174: property :OptionID, 120
175: property :Value, ['000963696F2D7563706C31056F73756164036F73750365647500']
176: property :VendorClass, ''
177: property :UserClass, ''
178: property :AddressFamily, 'IPv4'
179: end
180:
Compiled Resource:
------------------
# Declared in c:/chef/cache/cookbooks/fisher-role-dhcp-windows/recipes/default.rb:170:in `from_file'
dsc_resource("OptionValue120") do
action [:run]
default_guard_interpreter :default
properties {Ensure=>"Present", OptionID=>120, Value=>["000963696F2D7563706C31056F73756164036F73750365647500"], VendorClass=>"", UserClass=>"", AddressFamily=>"IPv4"}
resource :DhcpServerOptionValue
declared_type :dsc_resource
cookbook_name "fisher-role-dhcp-windows"
recipe_name "default"
module_name "xDhcpServer"
end
System Info:
------------
chef_version=14.13.11
platform=windows
platform_version=10.0.17763
ruby=ruby 2.5.5p157 (2019-03-15 revision 67260) [x64-mingw32]
program_name=C:/opscode/chef/bin/chef-client
executable=C:/opscode/chef/bin/chef-client
UserClass does not need to be mandatory. It is not required in the cmdlet.
dsc_resource 'OptionDef120' do
resource :xDhcpServerOptionDefinition
module_name 'xDhcpServer'
property :Ensure, 'Present'
property :Name, 'UCSipServer'
property :OptionID, 120
property :Type, 'BinaryData'
property :Description, 'Sip Server Fqdn'
property :VendorClass, ''
property :AddressFamily, 'IPv4'
end
dsc_resource 'OptionValue120' do
resource :DhcpServerOptionValue
module_name 'xDhcpServer'
property :Ensure, 'Present'
property :OptionID, 120
property :Value, ['000963696F2D7563706C31056F73756164036F73750365647500']
property :VendorClass, ''
property :AddressFamily, 'IPv4'
end
Followed by:
dsc_resource 'OptionValue120' do
resource :DhcpServerOptionValue
module_name 'xDhcpServer'
property :Ensure, 'Present'
property :OptionID, 120
property :Value, ['000963696F2D7563706C31056F73756164036F73750365647500']
property :VendorClass, ''
property :UserClass, ''
property :AddressFamily, 'IPv4'
end
OsName : Microsoft Windows Server 2019 Standard
OsOperatingSystemSKU : StandardServerEdition
OsArchitecture : 64-bit
WindowsVersion : 1809
WindowsBuildLabEx : 17763.1.amd64fre.rs5_release.180914-1434
OsLanguage : en-US
OsMuiLanguages : {en-US}
Name Value
PSVersion 5.1.17763.592
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.17763.592
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
2.0.0.0
To support automatic wiki documentation and conceptual help the schema mof files should have a description for each property.
The xDhcpServerScope actually requires the LeaseDuration property to be defined or the resource execution fails, but the configuration doesn't enforce this.
Module to manage the DHCP failover relationship as per PS cmdlets
Add-DhcpServerv4Failover, Set-DhcpServerv4Failover
Also create another module to add/update/remove additional scope to existing relationship
Add-DhcpServerv4FailoverScope
Windows 2012R2 has limitation of max 32 sources to single failover partner
The documentation in the README.md should be removed after it has been used to update the schema.mof files and the individual resource README.md (need to be created for each resource, see example of README.md).
Hi Team, please can you kindly add the ability to add/remove DHCP exclusion ranges.
Example below; At the moment only Method 1 is available.
Say for instance Network Devices/Servers sit on 192.168.1.1 to 192.168.1.20
Method 1: Scope 192.168.1.21 -> 192.168.1.254
Method 2: Scope 192.168.1.1 -> 192.168.1.254
Reservation 192.168.1.1 -> 192.168.1.20
Many organizations use Method 2 as best practice for defining DHCP scopes.
DHCP cmdlets to accomplish this;
Get-DhcpServerv4ExclusionRange
Add-DhcpServerv4ExclusionRange
Remove-DhcpServerv4ExclusionRange
Currently this configuration is valid per target node, the resource would generate a ping-pong behavior.
xDhcpServerAuthorization ServerAuthPresent
{
Ensure = 'Present'
}
xDhcpServerAuthorization ServerAuthAbsent
{
Ensure = 'Absent'
}
I suggest we add a new property IsSingleInstance that is the only type qualifier Key. See Writing a single-instance DSC resource (best practice).
This would make only this a valid configuration per target node.
xDhcpServerAuthorization ServerAuth
{
IsSingleInstance = 'Yes'
Ensure = 'Present'
}
The xDhcpServerAuthorisation resource always fails without an IP address supplied.
Just tried to execute DSC to create DHCP exclusions.
Other DSC resource xDhcpServerScope works just fine
# insert configuration here
``- name: Create scopes exclusions
win_dsc:
resource_name: DhcpServerExclusionRange
ScopeID: "{{ dhcp_range+'.'+item.value.number|string+'.0'}}"
IPStartRange: "{{ dhcp_range }}.{{item.value.exclusions[0].exstart}}"
IPEndRange: "{{ dhcp_range }}.{{item.value.exclusions[0].exend}}"
Ensure: present
loop: "{{ lookup('dict', dhcp_set) }}"`
#### The operating system the target node is running
<!--
Please provide as much as possible about the target node, for example
edition, version, build and language.
On OS with WMF 5.1 the following command can help get this information.
OsName : Microsoft Windows Server 2019 Standard
OsOperatingSystemSKU : StandardServerEdition
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
<!--
To help with this information, please run this command:
$PSVersionTable
-->
#### Version of the DSC module that was used
I'm trying to set the DNS-Domain and DNS-Server Adresse with the xDhcpServerOption resource, but the test always returns false
I'm working with Windows 10 and PS v5 ProductionPreview on Server 2012r2
AUSFÜHRLICH: [WIN-DC1]: [[xDhcpServerOption]192.168.18.0] Checking Dns server ip option ...
AUSFÜHRLICH: [WIN-DC1]: [[xDhcpServerOption]192.168.18.0] DNS server ip is not correct. Expected System.String[], actual
AUSFÜHRLICH: [WIN-DC1]: [[xDhcpServerOption]192.168.18.0] Setting DNS server ip option ...
AUSFÜHRLICH: [WIN-DC1]: [[xDhcpServerOption]192.168.18.0] DNS server ip option is set to System.String[].
AUSFÜHRLICH: [WIN-DC1]: [[xDhcpServerOption]192.168.18.0] Checking Dns domain name option ...
AUSFÜHRLICH: [WIN-DC1]: [[xDhcpServerOption]192.168.18.0] DNS domain name is not correct. Expected lab.local, actual
AUSFÜHRLICH: [WIN-DC1]: [[xDhcpServerOption]192.168.18.0] Setting DNS domain name option ...
AUSFÜHRLICH: [WIN-DC1]: [[xDhcpServerOption]192.168.18.0] DNS domain name option is set to lab.local.
AUSFÜHRLICH: [WIN-DC1]: [[xDhcpServerOption]192.168.18.0] Checking Dns server ip option ...
AUSFÜHRLICH: [WIN-DC1]: [[xDhcpServerOption]192.168.18.0] DNS server ip is not correct. Expected System.String[], actual
AUSFÜHRLICH: [WIN-DC1]: LCM: [ BeendenTesten ] [[xDhcpServerOption]192.168.18.0] False in 0.1560 Sekunden.
here is the conf:
xDhcpServerOtion '192.168.18.0'
{
ScopeID = '192.168.18.0'
AddressFamily = 'IPv4'
Router = '192.168.18.4'
DnsDomain = 'lab.local'
DnsServerIPAdress = '192.168.18.18','192.168.18.37'
Ensure = 'Present'
}
https://gallery.technet.microsoft.com/scriptcenter/xDhcpServer-PowerShell-f739cf90
The reservation sample reserves an ip address outside the sample scope given.
The options sample creates options for a scope that it doesn't give a sample of how to create.
When using the DhcpServerOptionValue resource to install DNS servers for the whole DHCP server, it fails when the DNS servers are not resolvable.
Just as when installing DNS servers via the GUI, it checks for the IP addresses to be resolvable. But due to different test scenarios or other scenarios where the DNS servers wouldn't be accessible, it fails when it cannot resolve the IP's.
PowerShell Cmdlet failed: 10.1.1.1 is not a valid DNS server.
+ CategoryInfo : InvalidArgument: (ZADHCP003:) [], CimException
+ FullyQualifiedErrorId : WIN32 87,Set-DhcpServerv4OptionValue
+ PSComputerName : localhost
The PowerShell DSC resource '[DhcpServerOptionValue]DirectResourceAccess' with SourceInfo '' threw one or more
non-terminating errors while running the Set-TargetResource functionality. These errors are logged to the ETW channel
called Microsoft-Windows-DSC/Operational. Refer to this channel for more details.
+ CategoryInfo : InvalidOperation: (root/Microsoft/...gurationManager:String) [], CimException
+ FullyQualifiedErrorId : NonTerminatingErrorFromProvider
+ PSComputerName : localhost
Add an optional -Force setting to allow for forcing the setting when the option isn't valid at this time.
configuration Sample_DhcpServerOptionValue_SetOption
{
Import-DscResource -module xDHCpServer
DhcpServerOptionValue DNSSettings
{
Ensure = 'Present'
OptionId = 6
Value = '10.1.1.1', '10.2.2.2', '10.3.3.3'
VendorClass = ''
AddressFamily = 'IPv4'
UserClass = ''
}
}
OsName : Microsoft Windows Server 2016 Datacenter
OsOperatingSystemSKU : DatacenterServerEdition
OsArchitecture : 64-bit
WindowsBuildLabEx : 14393.2665.amd64fre.rs1_release.181203-1755
OsLanguage : en-US
OsMuiLanguages : {en-US}
PSVersion 5.1.14393.2636
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.14393.2636
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
2.0.0.0
Issue to track the removal of the deprecated resource xDhcpServerOption in the future.
Is it possible to create dhcp reservations using this, in a parallel based approach?
If I have 1000s of reservations, I don't want the CRUD operations to be individually handled, but rather threaded.
Any advice on this would be great!
ISSUE DESCRIPTION (this template):
When trying to authorize multiple DHCP Servers I get an error which can be summarised as "Resources have identical key properties but there are differences in the following non-key properties: 'IPAddress;DnsName'."
Please provide information regarding your issue under each header below.
Write N/A under any headers that do not apply to your issue, or if the
information is not available.
Authorizing one server is fine. but multiple DHCP Servers with different DNS names and IP's throws the error below.
Names and IP's changed.
Test-ConflictingResources : A conflict was detected between resources '[xDhcpServerAuthorization]DHCP_Server_Authorisation_AK
(xxx\DSC\DC1-LA\DC1-LA_Configuration.ps1::250::9::xDhcpServerAuthorization)' and '[xDhcpServerAuthorization]DHCP_Server_Authorisation_FT
(xxx\DSC\DC1-LA\DC1-LA_Configuration.ps1::257::9::xDhcpServerAuthorization)' in node 'DC1-LA'. Resources have identical key properties but there are differences
in the following non-key properties: 'IPAddress;DnsName'. Values '1.1.1.1;DHCP01-AK.Domain.local' don't match values '2.2.2.2;DHCP01-FT.Domain.local'. Please update
these property values so that they are identical in both cases.
At line:289 char:9
Test-ConflictingResources $keywordName $canonicalizedValue $k ...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Test-ConflictingResources $keywordName $canonicalizedValue $k ...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Test-ConflictingResources $keywordName $canonicalizedValue $k ...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Test-ConflictingResources $keywordName $canonicalizedValue $k ...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Test-ConflictingResources $keywordName $canonicalizedValue $k ...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Test-ConflictingResources $keywordName $canonicalizedValue $k ...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
throw $ErrorRecord
~~~~~~~~~~~~~~~~~~
The validation of the IP and DNS name is not correct as the data for each is different for each DHCP Server.
# insert configuration here
DC1-LA_Configuration.ps1:
$Data = $ConfigurationData.DHCP_Server_Authorisation_AK
xDhcpServerAuthorization DHCP_Server_Authorisation_AK {
Ensure = $Data.Ensure
DnsName = $Data.DnsName
IPAddress = $Data.IPAddress
}
$Data = $ConfigurationData.DHCP_Server_Authorisation_FT
xDhcpServerAuthorization DHCP_Server_Authorisation_FT {
Ensure = $Data.Ensure
DnsName = $Data.DnsName
IPAddress = $Data.IPAddress
}
$Data = $ConfigurationData.DHCP_Server_Authorisation_HF
xDhcpServerAuthorization DHCP_Server_Authorisation_HF {
Ensure = $Data.Ensure
DnsName = $Data.DnsName
IPAddress = $Data.IPAddress
}
$Data = $ConfigurationData.DHCP_Server_Authorisation_MA
xDhcpServerAuthorization DHCP_Server_Authorisation_MA {
Ensure = $Data.Ensure
DnsName = $Data.DnsName
IPAddress = $Data.IPAddress
}
DC1-LA_CONFIG_DATA.psd1:
DHCP_Server_Authorisation_AK = @{
Ensure = 'Present' # 'Absent','Present'
DnsName = 'DHCP01-AK.Domain.local' # FQDN of the server to authorize. If not specified, it defaults to the local hostname of the enacting node.
IPAddress = '1.1.1.1' # IP v4 address of the server to authorized. If not specified, it default to the first IPv4 address of the enacting node.
} # This resource must run on an Active Directory domain controller.
DHCP_Server_Authorisation_FT = @{
Ensure = 'Present' # 'Absent','Present'
DnsName = 'DHCP01-FT.Domain.local' # FQDN of the server to authorize. If not specified, it defaults to the local hostname of the enacting node.
IPAddress = '2.2.2.2' # IP v4 address of the server to authorized. If not specified, it default to the first IPv4 address of the enacting node.
} # This resource must run on an Active Directory domain controller.
DHCP_Server_Authorisation_HF = @{
Ensure = 'Present' # 'Absent','Present'
DnsName = 'DHCP01-HF.Domain.local' # FQDN of the server to authorize. If not specified, it defaults to the local hostname of the enacting node.
IPAddress = '3.3.3.3' # IP v4 address of the server to authorized. If not specified, it default to the first IPv4 address of the enacting node.
} # This resource must run on an Active Directory domain controller.
DHCP_Server_Authorisation_MA = @{
Ensure = 'Present' # 'Absent','Present'
DnsName = 'DHCP01-MA.domain.local' # FQDN of the server to authorize. If not specified, it defaults to the local hostname of the enacting node.
IPAddress = 4.4.4.4' # IP v4 address of the server to authorized. If not specified, it default to the first IPv4 address of the enacting node.
} # This resource must run on an Active Directory domain controller.
2.0.0.0
Are there any plans on adding IPv6 DHCP support to this resource? I think it would be useful. It seems like this may have been planned for at some stage as there are AddressFamily parameters in the resources already.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.