
<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>DHCP PowerShell Commands Archives - TECHNIG</title>
	<atom:link href="https://www.technig.com/tag/dhcp-powershell-commands/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.technig.com/tag/dhcp-powershell-commands/</link>
	<description>Gateway for IT Experts and Tech Geeks</description>
	<lastBuildDate>Sat, 23 Apr 2022 10:09:45 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.6.2</generator>

<image>
	<url>https://www.technig.com/wp-content/uploads/2020/04/32x32.png</url>
	<title>DHCP PowerShell Commands Archives - TECHNIG</title>
	<link>https://www.technig.com/tag/dhcp-powershell-commands/</link>
	<width>32</width>
	<height>32</height>
</image> 
<site xmlns="com-wordpress:feed-additions:1">162720667</site>	<item>
		<title>Configure a DHCP Scope in Server 2022 Using PowerShell</title>
		<link>https://www.technig.com/configure-a-dhcp-scope-in-server-2022-using-powershell/</link>
					<comments>https://www.technig.com/configure-a-dhcp-scope-in-server-2022-using-powershell/#respond</comments>
		
		<dc:creator><![CDATA[Danish]]></dc:creator>
		<pubDate>Sat, 23 Apr 2022 10:09:43 +0000</pubDate>
				<category><![CDATA[MCSA]]></category>
		<category><![CDATA[Servers]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[Configure DHCP Scope]]></category>
		<category><![CDATA[Create storage pool on Windows Server 2022]]></category>
		<category><![CDATA[DHCP Configuration]]></category>
		<category><![CDATA[DHCP PowerShell Commands]]></category>
		<category><![CDATA[DHCP Scope Commands]]></category>
		<category><![CDATA[DHCP Server]]></category>
		<category><![CDATA[How to]]></category>
		<category><![CDATA[Windows PowerShell]]></category>
		<category><![CDATA[Windows Server 2022]]></category>
		<guid isPermaLink="false">https://www.technig.com/?p=17409</guid>

					<description><![CDATA[<div style="margin-bottom:20px;"><img width="1221" height="694" src="https://www.technig.com/wp-content/uploads/2022/04/WinServer2022-5.jpg" class="attachment-post-thumbnail size-post-thumbnail wp-post-image" alt="Configure a DHCP Scope Using Windows PowerShell on Windows Server 2022" decoding="async" fetchpriority="high" srcset="https://www.technig.com/wp-content/uploads/2022/04/WinServer2022-5.jpg 1221w, https://www.technig.com/wp-content/uploads/2022/04/WinServer2022-5-300x171.jpg 300w, https://www.technig.com/wp-content/uploads/2022/04/WinServer2022-5-1024x582.jpg 1024w, https://www.technig.com/wp-content/uploads/2022/04/WinServer2022-5-768x437.jpg 768w" sizes="(max-width: 1221px) 100vw, 1221px" /></div>
<p>As an essential part of a DHCP Server, we create and configure a DHCP Scope to specify the range of IP addresses from which a DHCP server can assign one to a client in our subnet. That is the primary and well-known use of a DHCP Scope. There are multiple ways to create and configure [&#8230;]</p>
<p>The post <a href="https://www.technig.com/configure-a-dhcp-scope-in-server-2022-using-powershell/">Configure a DHCP Scope in Server 2022 Using PowerShell</a> appeared first on <a href="https://www.technig.com">TECHNIG</a>.</p>
]]></description>
										<content:encoded><![CDATA[<div style="margin-bottom:20px;"><img width="1221" height="694" src="https://www.technig.com/wp-content/uploads/2022/04/WinServer2022-5.jpg" class="attachment-post-thumbnail size-post-thumbnail wp-post-image" alt="Configure a DHCP Scope Using Windows PowerShell on Windows Server 2022" decoding="async" loading="lazy" srcset="https://www.technig.com/wp-content/uploads/2022/04/WinServer2022-5.jpg 1221w, https://www.technig.com/wp-content/uploads/2022/04/WinServer2022-5-300x171.jpg 300w, https://www.technig.com/wp-content/uploads/2022/04/WinServer2022-5-1024x582.jpg 1024w, https://www.technig.com/wp-content/uploads/2022/04/WinServer2022-5-768x437.jpg 768w" sizes="(max-width: 1221px) 100vw, 1221px" /></div>
<p>As an essential part of a <a href="https://docs.microsoft.com/en-us/iis/web-hosting/installing-infrastructure-components/dhcp-server" target="_blank" rel="noreferrer noopener">DHCP Server</a>, we create and configure a DHCP Scope to specify the range of IP addresses from which a DHCP server can assign one to a client in our subnet. That is the primary and well-known use of a DHCP Scope. There are multiple ways to create and configure a DHCP Scope in Windows Server OSs including Windows Server 2022. One interesting, easy, and yet professional method is using Windows PowerShell. Throughout this article, we will cover the steps to configure a DHCP Scope in Windows Server 2022 Using PowerShell.</p>



<p>To create and configure a DHCP Scope using the GUI method, read <a href="https://www.technig.com/create-and-configure-a-dhcp-scope-in-windows-server-2022/" target="_blank" rel="noreferrer noopener">Create And Configure A DHCP Scope In Windows Server 2022</a> article. </p>



<p>You may also like to read: <a href="https://www.technig.com/install-and-configure-dhcp-using-powershell-in-windows-server-2022/" target="_blank" rel="noreferrer noopener">Install And Configure DHCP In Windows Server 2022 Using PowerShell</a>.</p>



<h2 class="wp-block-heading">DHCP Scope Configuration Steps Using PowerShell</h2>



<p>Using Windows PowerShell, we just write the commands and run them directly. That means, we must know the related commands and have a good knowledge of working with PowerShell. This section will describe all the details to configure a DHCP Scope in Server 2022 using PowerShell in the below simple steps. Let&#8217;s dive into it. </p>



<h3 class="wp-block-heading">Step 1: Open Windows PowerShell </h3>



<p>In the <strong>Start Menu </strong>right-click on <strong>Windows PowerShell</strong> and choose <strong>Run as Administrator.</strong> Search for it if it is not available in the Start Menu. We can also open it from the <strong>Run </strong>by typing <strong>powershell </strong>in the <strong>Run </strong>dialogue box.  </p>



<div class="wp-block-image"><figure class="aligncenter size-full is-resized"><img decoding="async" src="https://www.technig.com/wp-content/uploads/2022/04/1-3.jpg" alt="Opening Windows PowerShell as administrator" class="wp-image-17469" width="763" height="493" srcset="https://www.technig.com/wp-content/uploads/2022/04/1-3.jpg 790w, https://www.technig.com/wp-content/uploads/2022/04/1-3-300x194.jpg 300w, https://www.technig.com/wp-content/uploads/2022/04/1-3-768x496.jpg 768w, https://www.technig.com/wp-content/uploads/2022/04/1-3-210x136.jpg 210w" sizes="(max-width: 763px) 100vw, 763px" /><figcaption>Opening Windows PowerShell as an administrator</figcaption></figure></div>



<h3 class="wp-block-heading">Step 2: Create a New DHCP Scope Using PowerShell</h3>



<p>To create a new scope, we use the <strong>Add-DhcpServerv4Scope</strong> PowerShell command. Using this command, we need to specify the following four parameters: </p>



<ul class="wp-block-list"><li>The first one is the scope name. We use the <strong>-Name</strong> parameter name followed by the scope name enclosed in the double quotation. </li><li>Secondly, we specify the start of the range IP address using the <strong>-StartRange </strong>parameter name followed by its value (IP address). </li><li>The third one is to specify the end of the rage IP address using the <strong>-EndRange</strong> parameter name followed by its value (IP address).  </li><li>And, the last one is to specify the subnet mask IP address using <strong>-SubnetMask</strong> parameter name followed by its address. </li></ul>



<p>As of my new scope, the whole command becomes <code>Add-DhcpServerv4Scope -Name "Office B" -StartRange 192.168.1.100 -EndRange 192.168.1.2 -SubnetMask 255.255.255.0</code> See the picture illustration below.</p>



<div class="wp-block-image"><figure class="aligncenter size-full"><img decoding="async" width="982" height="198" src="https://www.technig.com/wp-content/uploads/2022/04/2-8.jpg" alt="Windows PowerShell Command to Create a New DHCP Scope" class="wp-image-17481" srcset="https://www.technig.com/wp-content/uploads/2022/04/2-8.jpg 982w, https://www.technig.com/wp-content/uploads/2022/04/2-8-300x60.jpg 300w, https://www.technig.com/wp-content/uploads/2022/04/2-8-768x155.jpg 768w" sizes="(max-width: 982px) 100vw, 982px" /><figcaption>Windows PowerShell Command to Create a New DHCP Scope</figcaption></figure></div>



<h3 class="wp-block-heading">Step 3: Verify DHCP Scope Using PowerShell</h3>



<p>Now that we have created our new DHCP Scope in step 2, we can verify it using the <code>Get-DhcpServerV4Scope</code>PowerShell command. Using this command, we can see a list of DHCP Scopes available on our DHCP Server. We can see the details for each of the scopes such as <strong>Scop ID</strong> which is most often used for further configuration of a DHCP Scope. See the illustration in the below image. </p>



<div class="wp-block-image"><figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="945" height="268" src="https://www.technig.com/wp-content/uploads/2022/04/3-4.jpg" alt="Verify DHCP Scope in Server 2022 Using Windows PowerShell" class="wp-image-17484" srcset="https://www.technig.com/wp-content/uploads/2022/04/3-4.jpg 945w, https://www.technig.com/wp-content/uploads/2022/04/3-4-300x85.jpg 300w, https://www.technig.com/wp-content/uploads/2022/04/3-4-768x218.jpg 768w" sizes="(max-width: 945px) 100vw, 945px" /><figcaption>Verify DHCP Scope in Server 2022 Using Windows PowerShell</figcaption></figure></div>



<h3 class="wp-block-heading">Step 4: Add Exclusion Range in a DHCP Scope Using PowerShell</h3>



<p>To add a new Exclusion Range in a DHCP Scope, we use the <strong>Add-DhcpServerv4ExclusionRange</strong> PowerShell command. We specify the scope using the <strong>-ScopeId</strong> property. Then we use the <strong>-StartRange </strong>and <strong>-EndRange</strong> parameters each followed by the IP address that makes up the exclusion range. The command we used to create an exclusion range is<code>Add-DhcpServerv4ExclusionRange -ScopeId 192.168.1.0 -StartRange 192.168.1.150 -EndRange 192.168.1.160</code>. Looking into it, we see that we have created an exclusion range that starts at <strong>192.168.1.150</strong> and ends at <strong>192.168.1.160</strong> in our scope with scope ID <strong>192.168.1.0</strong>. </p>



<div class="wp-block-image"><figure class="aligncenter size-full is-resized"><img loading="lazy" decoding="async" src="https://www.technig.com/wp-content/uploads/2022/04/4-4.jpg" alt="Adding Exclusion Range in a DHCP Scope PowerShell Command " class="wp-image-17486" width="840" height="156" srcset="https://www.technig.com/wp-content/uploads/2022/04/4-4.jpg 907w, https://www.technig.com/wp-content/uploads/2022/04/4-4-300x56.jpg 300w, https://www.technig.com/wp-content/uploads/2022/04/4-4-768x143.jpg 768w" sizes="(max-width: 840px) 100vw, 840px" /><figcaption>Adding Exclusion Range in a DHCP Scope PowerShell Command </figcaption></figure></div>



<p>We can also verify the Exclusion Range(s) in a specific DHCP Scope. To do so, use the command <strong>Get-DhcpServerv4ExclusionRange.</strong> We should use the Scope ID with this command to point to our specific Scope. So, our command is <code>Get-DhcpServerv4ExclusionRange -ScopeId 192.168.1.0</code>. As we see, the picture below shows the exclusion range we just created. </p>



<div class="wp-block-image"><figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="922" height="223" src="https://www.technig.com/wp-content/uploads/2022/04/4-2-1.jpg" alt="Verifying Exclusion Range in DHCP Scope Using PowerShell" class="wp-image-17488" srcset="https://www.technig.com/wp-content/uploads/2022/04/4-2-1.jpg 922w, https://www.technig.com/wp-content/uploads/2022/04/4-2-1-300x73.jpg 300w, https://www.technig.com/wp-content/uploads/2022/04/4-2-1-768x186.jpg 768w" sizes="(max-width: 922px) 100vw, 922px" /><figcaption>Verifying Exclusion Range in DHCP Scope Using PowerShell</figcaption></figure></div>



<h3 class="wp-block-heading">Step 5: Set the Lease Duration Using PowerShell</h3>



<p>Use the <strong>Set-DhcpServerv4Scope</strong> PowerShell command to set the lease duration. We must point to the scope using the<strong> -ScopeId</strong> parameter name followed by its value. Then we just specify the <strong>Lease Duration</strong> using the &#8211;<strong>LeaseDuration</strong> parameter name followed by its value. The format to define the <strong>Lease Duration</strong> value is <strong>day.hours:minutes:seconds</strong>. Saying those explanations, the whole command to define the <strong>Lease Duration</strong>, in our example, is <code>Set-DhcpServerv4Scope -ScopeId 192.168.1.0 -LeaseDuration 10.00:00:00</code>. Also shown in the below image. A duration of 10 days is defined for the Lease Duration in our example. </p>



<div class="wp-block-image"><figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="980" height="195" src="https://www.technig.com/wp-content/uploads/2022/04/5-6.jpg" alt="Defining Lease Duration for a DHCP Scope using PowerShell" class="wp-image-17500" srcset="https://www.technig.com/wp-content/uploads/2022/04/5-6.jpg 980w, https://www.technig.com/wp-content/uploads/2022/04/5-6-300x60.jpg 300w, https://www.technig.com/wp-content/uploads/2022/04/5-6-768x153.jpg 768w" sizes="(max-width: 980px) 100vw, 980px" /><figcaption>Defining Lease Duration for a DHCP Scope using PowerShell</figcaption></figure></div>



<p>Now, to verify the Lease Duration configuration, use <code>Get-DhcpServerv4Scope</code> the command. By default, it is set to 8 days. But as we defined 10 days for it, we can see the changes. </p>



<div class="wp-block-image"><figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="982" height="235" src="https://www.technig.com/wp-content/uploads/2022/04/6-4.jpg" alt="Verifying DHCP Lease Duration Using PowerShell" class="wp-image-17501" srcset="https://www.technig.com/wp-content/uploads/2022/04/6-4.jpg 982w, https://www.technig.com/wp-content/uploads/2022/04/6-4-300x72.jpg 300w, https://www.technig.com/wp-content/uploads/2022/04/6-4-768x184.jpg 768w" sizes="(max-width: 982px) 100vw, 982px" /><figcaption>Verifying DHCP Lease Duration Using PowerShell</figcaption></figure></div>



<h3 class="wp-block-heading">Step 6: Configure the Default Gateway Using PowerShell</h3>



<p>We can specify the <strong>Default Gateway</strong> for a DHCP Scope using the <strong>Set-DhcpServerv4OptionValue</strong> command. Like other steps, we need to point to the Scope using the Scope ID. We use the parameter name <strong>-Router </strong>followed by its value (IP address) to define the <strong>Default Gateway </strong>for a DHCP Scope. In our example, the complete command is <code>Set-DhcpServerv4OptionValue -ScopeId 192.168.1.0 -Router 192.168.1.1</code>.  We set <strong>192.168.1.1</strong> as the<strong> Default Gateway </strong>address for our DHCP Scope. </p>



<div class="wp-block-image"><figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="982" height="152" src="https://www.technig.com/wp-content/uploads/2022/04/7-3.jpg" alt="Defining Default Gateway Address for a DHCP Scope using PowerShell" class="wp-image-17505" srcset="https://www.technig.com/wp-content/uploads/2022/04/7-3.jpg 982w, https://www.technig.com/wp-content/uploads/2022/04/7-3-300x46.jpg 300w, https://www.technig.com/wp-content/uploads/2022/04/7-3-768x119.jpg 768w" sizes="(max-width: 982px) 100vw, 982px" /><figcaption>Defining Default Gateway Address for a DHCP Scope using PowerShell</figcaption></figure></div>



<p>We will verify the Default Gateway configuration at the end of the next step, as we use the same command to verify these two steps.</p>



<h3 class="wp-block-heading">Step 7: Configure DNS Domain and DNS Server Using PowerShell</h3>



<p>As the Default Gateway configuration, we use the <strong>Set-DhcpServerv4OptionValue</strong> PowerShell command to configure the <strong>DNS Domain</strong> and <strong>DNS Server</strong>. We can configure the three of them in one command line using their parameter names and their values. Use <strong>-DnsServer</strong> parameter name followed by its value (IP Address) to configure the DNS Server. Use the <strong>-DnsDomain</strong> parameter name followed by its value enclosed in double quotation to configure the DNS Domain. Remember to address the scope using the <strong>Scope ID</strong> properties. In my example, the whole command becomes <code>Set-DhcpServerv4OptionValue -ScopeId 192.168.1.0 -DnsServer 192.168.1.2 -DnsDomain "Technig.com"</code>. </p>



<div class="wp-block-image"><figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="980" height="129" src="https://www.technig.com/wp-content/uploads/2022/04/8-3.jpg" alt="Configuring DNS Server and DNS Domain in a DHCP Scope Using PowerShell" class="wp-image-17507" srcset="https://www.technig.com/wp-content/uploads/2022/04/8-3.jpg 980w, https://www.technig.com/wp-content/uploads/2022/04/8-3-300x39.jpg 300w, https://www.technig.com/wp-content/uploads/2022/04/8-3-768x101.jpg 768w" sizes="(max-width: 980px) 100vw, 980px" /><figcaption>Configuring DNS Server and DNS Domain in a DHCP Scope Using PowerShell</figcaption></figure></div>



<p>To verify the Default Gateway configuration, DNS Server configuration, and DNS Domain configuration, use the <strong>Get-DhcpServerv4OptionValue</strong> PowerShell command followed by the Scope ID properties. In my case, <code>Get-DhcpServerv4OptionValue -ScopeId 192.168.1.0</code> is the whole command line. </p>



<div class="wp-block-image"><figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="938" height="287" src="https://www.technig.com/wp-content/uploads/2022/04/9-3.jpg" alt="Verify DNS Server, DNS Domain and Default Gateway Configurations Using PowerShell" class="wp-image-17509" srcset="https://www.technig.com/wp-content/uploads/2022/04/9-3.jpg 938w, https://www.technig.com/wp-content/uploads/2022/04/9-3-300x92.jpg 300w, https://www.technig.com/wp-content/uploads/2022/04/9-3-768x235.jpg 768w" sizes="(max-width: 938px) 100vw, 938px" /><figcaption>Verify DNS Server, DNS Domain and Default Gateway Configurations Using PowerShell</figcaption></figure></div>



<p>That is all with the DHCP Scope configuration using PowerShell commands. We can do all the settings and configuration, which we could do with the GUI method, using PowerShell. This method may not be user-friendly, but it is a time-saving, professional and maybe elegant method. </p>



<h3 class="wp-block-heading">Delete A DHCP Scope Using PowerShell</h3>



<p>In addition to the above DHCP configuration steps, this is the appropriate point to describe how we can delete a DHCP Scope using Windows PowerShell. To delete a DHCP Scope, use the <strong>-Remove-DhcpServerv4Scope</strong> command followed by the <strong>-ScopeId</strong> properties. Considering the DHCP scope I work with, the complete command is <code>-Remove-DhcpServerv4Scope -ScopeId 192.168.1.10</code>. See the picture below. </p>



<div class="wp-block-image"><figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="937" height="154" src="https://technig.com/wp-content/uploads/2022/04/10-2.jpg" alt="Removing a DHCP Scope using PowerShell" class="wp-image-17515" srcset="https://www.technig.com/wp-content/uploads/2022/04/10-2.jpg 937w, https://www.technig.com/wp-content/uploads/2022/04/10-2-300x49.jpg 300w, https://www.technig.com/wp-content/uploads/2022/04/10-2-768x126.jpg 768w" sizes="(max-width: 937px) 100vw, 937px" /><figcaption>Removing a DHCP Scope using PowerShell</figcaption></figure></div>



<p>Now, to verify if it is deleted, run the <strong>Get-DhcpServerV4Scope</strong> command and there will no longer be that scope available. </p>



<div class="wp-block-image"><figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="937" height="141" src="https://technig.com/wp-content/uploads/2022/04/11-2.jpg" alt="Verifying DHCP Scope deletion using PowerShell" class="wp-image-17516" srcset="https://www.technig.com/wp-content/uploads/2022/04/11-2.jpg 937w, https://www.technig.com/wp-content/uploads/2022/04/11-2-300x45.jpg 300w, https://www.technig.com/wp-content/uploads/2022/04/11-2-768x116.jpg 768w" sizes="(max-width: 937px) 100vw, 937px" /><figcaption>Verifying DHCP Scope deletion using PowerShell</figcaption></figure></div>



<p>As simple as that, we can delete a DHCP Scope and verify the deletion using Windows PowerShell. </p>



<h2 class="wp-block-heading">Conclusion</h2>



<p>In a step by step approach, we covered how to configure a DHCP Scope in Windows Server 2022 using Windows PowerShell. We discussed the PowerShell command for creating a new DHCP Scope in an initial step. Then we went through the steps to add an exclusion range, the default gateway, DNS Domain, and DNS Server to a DHCP Scope all using the PowerShell command. Of course, we also verified each step. Lastly, we covered how we can remove a DHCP scope using PowerShell.</p>



<p>I hope you found this article helpful to your questions. You can always share us your thoughts and queries in the comment section.</p>
<p>The post <a href="https://www.technig.com/configure-a-dhcp-scope-in-server-2022-using-powershell/">Configure a DHCP Scope in Server 2022 Using PowerShell</a> appeared first on <a href="https://www.technig.com">TECHNIG</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.technig.com/configure-a-dhcp-scope-in-server-2022-using-powershell/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">17409</post-id>	</item>
		<item>
		<title>Install and Configure DHCP in Windows Server 2022 Using PowerShell</title>
		<link>https://www.technig.com/install-and-configure-dhcp-using-powershell-in-windows-server-2022/</link>
					<comments>https://www.technig.com/install-and-configure-dhcp-using-powershell-in-windows-server-2022/#respond</comments>
		
		<dc:creator><![CDATA[Danish]]></dc:creator>
		<pubDate>Wed, 13 Apr 2022 09:54:04 +0000</pubDate>
				<category><![CDATA[MCSA]]></category>
		<category><![CDATA[Servers]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[DHCP PowerShell Commands]]></category>
		<category><![CDATA[DHCP Server]]></category>
		<category><![CDATA[How to]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[PowerShell Articles]]></category>
		<category><![CDATA[Windows PowerShell]]></category>
		<category><![CDATA[Windows Server 2022]]></category>
		<guid isPermaLink="false">https://www.technig.com/?p=17264</guid>

					<description><![CDATA[<div style="margin-bottom:20px;"><img width="1103" height="683" src="https://www.technig.com/wp-content/uploads/2022/04/feature-Image-2.jpg" class="attachment-post-thumbnail size-post-thumbnail wp-post-image" alt="Install and Configure DHCP in Windows Server 2022 using Windows PowerShell" decoding="async" loading="lazy" srcset="https://www.technig.com/wp-content/uploads/2022/04/feature-Image-2.jpg 1103w, https://www.technig.com/wp-content/uploads/2022/04/feature-Image-2-300x186.jpg 300w, https://www.technig.com/wp-content/uploads/2022/04/feature-Image-2-1024x634.jpg 1024w, https://www.technig.com/wp-content/uploads/2022/04/feature-Image-2-768x476.jpg 768w" sizes="(max-width: 1103px) 100vw, 1103px" /></div>
<p>We have published a step by step guide on how to install and configure DHCP in Server 2022 using Server Manager. This article, in turn, covers an easy and step by step guide on how to install and configure DHCP in Server 2022 using Windows PowerShell. Using PowerShell to perform such technical tasks is always [&#8230;]</p>
<p>The post <a href="https://www.technig.com/install-and-configure-dhcp-using-powershell-in-windows-server-2022/">Install and Configure DHCP in Windows Server 2022 Using PowerShell</a> appeared first on <a href="https://www.technig.com">TECHNIG</a>.</p>
]]></description>
										<content:encoded><![CDATA[<div style="margin-bottom:20px;"><img width="1103" height="683" src="https://www.technig.com/wp-content/uploads/2022/04/feature-Image-2.jpg" class="attachment-post-thumbnail size-post-thumbnail wp-post-image" alt="Install and Configure DHCP in Windows Server 2022 using Windows PowerShell" decoding="async" loading="lazy" srcset="https://www.technig.com/wp-content/uploads/2022/04/feature-Image-2.jpg 1103w, https://www.technig.com/wp-content/uploads/2022/04/feature-Image-2-300x186.jpg 300w, https://www.technig.com/wp-content/uploads/2022/04/feature-Image-2-1024x634.jpg 1024w, https://www.technig.com/wp-content/uploads/2022/04/feature-Image-2-768x476.jpg 768w" sizes="(max-width: 1103px) 100vw, 1103px" /></div>
<p>We have published a step by step guide on <a href="https://www.technig.com/install-and-configure-dhcp-in-windows-server-2022-using-server-manager/" target="_blank" rel="noreferrer noopener">how to install and configure DHCP in Server 2022 using Server Manager</a>. This article, in turn, covers an easy and step by step guide on how to install and configure DHCP in Server 2022 using <a href="https://docs.microsoft.com/en-us/powershell/scripting/overview?view=powershell-7.2" target="_blank" rel="noreferrer noopener">Windows PowerShell</a>. Using PowerShell to perform such technical tasks is always a preferred alternative for IT pros. Besides other benefits, using Powershell takes us less time to complete the tasks. It is, of course, a professional way to accomplish almost any task in Windows Server operating systems. </p>



<h2 class="wp-block-heading">Steps to Install and Configure DHCP Using PowerShell</h2>



<p>Generally, the process of DHCP installation and configuration in Windows Server encompasses three tasks: installing the DHCP capability and its management tools, adding security groups, and authorizing DHCP in Active Directory. Let&#8217;s dive into the steps. </p>



<ul class="wp-block-list"><li>Open the <strong>PowerShell </strong>from the <strong>Start Menu.</strong> See the picture below. You can also open it from <strong>Run </strong>using<code>powershell</code>command in the <strong>Run </strong>dialogue box. </li></ul>



<div class="wp-block-image"><figure class="aligncenter size-full is-resized"><img loading="lazy" decoding="async" src="https://www.technig.com/wp-content/uploads/2022/04/1-1.jpg" alt="Opening PowerShell on Windows Server 2022 | DHCP installation and Configuration using PowerShell" class="wp-image-17324" width="693" height="502" srcset="https://www.technig.com/wp-content/uploads/2022/04/1-1.jpg 725w, https://www.technig.com/wp-content/uploads/2022/04/1-1-300x217.jpg 300w" sizes="(max-width: 693px) 100vw, 693px" /><figcaption>Opening PowerShell on Windows Server 2022</figcaption></figure></div>



<ul class="wp-block-list"><li>Before straightly going to the DHCP installation command, run the<code>Get-WindowsFeature</code>command. This command lists all the features available in Windows Server 2022. It shows the name and installation state of those features. As the picture below shows, we have the <strong>DHCP </strong>feature available to install. </li></ul>



<div class="wp-block-image"><figure class="aligncenter size-full is-resized"><img loading="lazy" decoding="async" src="https://www.technig.com/wp-content/uploads/2022/04/2-2.jpg" alt="Get-WindowsFeatures Windows PowerShell Command and Checking DHCP Feature" class="wp-image-17325" width="719" height="377"/><figcaption>Get-WindowsFeatures Windows PowerShell Command</figcaption></figure></div>



<ul class="wp-block-list"><li>To install DHCP and its management tools, run the command<code>Install-WindowsFeature DHCP -IncludeManagementTools.</code>Wait for a while till it finishes the installation, and you will see the details upon successful installation. </li></ul>



<div class="wp-block-image"><figure class="aligncenter size-full is-resized"><img loading="lazy" decoding="async" src="https://www.technig.com/wp-content/uploads/2022/04/3-2.jpg" alt="DHCP Installation Windows PowerShell Command" class="wp-image-17326" width="738" height="185" srcset="https://www.technig.com/wp-content/uploads/2022/04/3-2.jpg 923w, https://www.technig.com/wp-content/uploads/2022/04/3-2-300x75.jpg 300w, https://www.technig.com/wp-content/uploads/2022/04/3-2-768x192.jpg 768w" sizes="(max-width: 738px) 100vw, 738px" /><figcaption>DHCP Installation Windows PowerShell Command</figcaption></figure></div>



<ul class="wp-block-list"><li>Now, run the<code>netsh DHCP add SecurityGroups</code>command to add the DHCP local security groups.</li></ul>



<div class="wp-block-image"><figure class="aligncenter size-full is-resized"><img loading="lazy" decoding="async" src="https://www.technig.com/wp-content/uploads/2022/04/4-2.jpg" alt="Windows PowerShell Command to Add DHCP Security Group" class="wp-image-17327" width="738" height="174" srcset="https://www.technig.com/wp-content/uploads/2022/04/4-2.jpg 876w, https://www.technig.com/wp-content/uploads/2022/04/4-2-300x71.jpg 300w, https://www.technig.com/wp-content/uploads/2022/04/4-2-768x181.jpg 768w" sizes="(max-width: 738px) 100vw, 738px" /><figcaption>Windows PowerShell Command to Add DHCP Security Group</figcaption></figure></div>



<ul class="wp-block-list"><li>The next step is to authorize the DHCP server to the Active Directory. To do so, use the command <code>Add-DhcpServerInDC -DnsName ServerName.DomainName.</code>Use your DHCP server name instead of the <strong>ServerName </strong>and your domain name instead of the <strong>DomainName </strong>in the above command. In my case, <strong>technigDC </strong>is the DHCP server name, and Technig.com is the domain name, as shown in the below picture.</li></ul>



<div class="wp-block-image"><figure class="aligncenter size-full is-resized"><img loading="lazy" decoding="async" src="https://www.technig.com/wp-content/uploads/2022/04/5-4.jpg" alt="Window PowerShell Command to Authorize DHCP in Active Directory Domain Services on Windows Server 2022" class="wp-image-17328" width="744" height="193" srcset="https://www.technig.com/wp-content/uploads/2022/04/5-4.jpg 871w, https://www.technig.com/wp-content/uploads/2022/04/5-4-300x78.jpg 300w, https://www.technig.com/wp-content/uploads/2022/04/5-4-768x200.jpg 768w" sizes="(max-width: 744px) 100vw, 744px" /><figcaption>Window PowerShell Command to Authorize DHCP in Active Directory Domain Services</figcaption></figure></div>



<ul class="wp-block-list"><li>At this point, we are all done with our DHCP installation and configuration. We can view the authorized DHCP servers in Active Directory using<code>Get-DhcpServerInDC</code>command.</li></ul>



<div class="wp-block-image"><figure class="aligncenter size-full is-resized"><img loading="lazy" decoding="async" src="https://www.technig.com/wp-content/uploads/2022/04/6-2.jpg" alt="Windows PowerShell Command to Check Authorized DHCP Servers in Active Directory" class="wp-image-17329" width="752" height="200" srcset="https://www.technig.com/wp-content/uploads/2022/04/6-2.jpg 864w, https://www.technig.com/wp-content/uploads/2022/04/6-2-300x80.jpg 300w, https://www.technig.com/wp-content/uploads/2022/04/6-2-768x205.jpg 768w" sizes="(max-width: 752px) 100vw, 752px" /><figcaption>Windows PowerShell Command to Check Authorized DHCP Servers</figcaption></figure></div>



<p>That is all with DHCP installation and configuration using Windows PowerShell. That simple, it is installed and authorized. </p>



<h2 class="wp-block-heading">Summary</h2>



<p>Using Windows PowerShell is a professional way of completing configuration tasks on Windows OSs, including Windows Server 2022. Throughout this article, we explained how we can install and configure DHCP on Windows Server 2022 using the PowerShell tool. We saw that we can easily do it using a few simple command lines. </p>



<p>In the end, I hope you found this article helpful. Feel free to put your related questions in the comment section below. </p>
<p>The post <a href="https://www.technig.com/install-and-configure-dhcp-using-powershell-in-windows-server-2022/">Install and Configure DHCP in Windows Server 2022 Using PowerShell</a> appeared first on <a href="https://www.technig.com">TECHNIG</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.technig.com/install-and-configure-dhcp-using-powershell-in-windows-server-2022/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">17264</post-id>	</item>
	</channel>
</rss>
