How to conigure 161 DHCP Option for multiple server using powershell

Mohd Arif 926 Reputation points
2022-12-01T07:59:07.477+00:00

I have to run the below command on multiple DHCP servers, let say DHCP01, DHCP02, DHCP03, DHCP04. Below command is fine, I have run it one few servers one by one and it works good. But, I need to specify on all servers in one time so I need to configure some logic which I am not able to think of. Please help me.

Get-DhcpServerv4Scope -ComputerName server01.superit.in | Where-Object {$_.Name -like "telephony"} | Set-DhcpServerv4OptionValue -ComputerName $Server -OptionId 161 -Value 'HTTPS://Polycom.super.in:8443'

Windows Server
Windows Server
A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.
12,205 questions
Windows DHCP
Windows DHCP
Windows: A family of Microsoft operating systems that run across personal computers, tablets, laptops, phones, internet of things devices, self-contained mixed reality headsets, large collaboration screens, and other devices.DHCP: Dynamic Host Configuration Protocol (DHCP). A communications protocol that lets network administrators manage centrally and automate the assignment of Internet Protocol (IP) addresses in an organization's network.
1,023 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,389 questions
0 comments No comments
{count} votes

Accepted answer
  1. Rich Matheisen 45,096 Reputation points
    2022-12-01T15:59:38.137+00:00

    Try the Get-DhcpServerInDC cmdlet to get the names of the authorized DHCP servers. Pipe the server name into a ForEach-Object loop and use that name as the value for the -ComputerName in your existing script.

    0 comments No comments

0 additional answers

Sort by: Most helpful