Closed cremenescu closed 4 hours ago
when running the script a second time on the same server, the option 119 being defined as a global option we receive the error:
PS C:\Windows\system32> C:\Users\Administrator\Desktop\powershell-dhcp.ps1 Add-DhcpServerv4OptionDefinition : Failed to add option definition 119 on DHCP server WIN-L1IGF678TUT. At C:\Users\Administrator\Desktop\powershell-dhcp.ps1:15 char:1 + Add-DhcpServerv4OptionDefinition -OptionId 119 -Name 'Domain Search L ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ResourceExists: (119:root/Microsoft/...ptionDefinition) [Add-DhcpServerv4OptionDefinition], CimException + FullyQualifiedErrorId : DHCP 20009,Add-DhcpServerv4OptionDefinition `
updated the code.
when running the script a second time on the same server, the option 119 being defined as a global option we receive the error: