# DHCP Scope Name

**URL:** <https://forums.powershell.org/t/dhcp-scope-name/12064>\
**Category:** PowerShell Help\
**Created:** [February 20, 2019, 7:50am UTC](https://forums.powershell.org/t/dhcp-scope-name/12064 "2019-02-20T07:50:41Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![mikedavidson1975](https://avatars.discourse-cdn.com/v4/letter/m/e8c25b/32.png) [@mikedavidson1975](https://forums.powershell.org/u/mikedavidson1975)\
**Post date:** [February 20, 2019, 7:50am UTC](https://forums.powershell.org/t/dhcp-scope-name/12064/1 "2019-02-20T07:50:41Z")

</div>

So, I am currently starting my first script.

It is already proving extremely useful and pulling all the information that I require except for 2 things:

1. I would like to see the AD OU of the computer (as per properties, object)
2. I would like to see the Superscope name from DHCP (Scope [1.2.3.4] Anywhere Student VLAN

Here is my script so far, which is working, but getting these 2 added would sell Powershell scripting to me!

$name = Read-Host -Prompt “What is the name of the computer?”  
Get-WmiObject -Class win32\_computersystem -ComputerName $name | select username,name,description,domain,manufacturer,model,PrimaryOwnerName,TotalPhysicalMemory  
Get-WmiObject Win32\_NetworkAdapterConfiguration -ComputerName $name | Select IPAddress | Where-Object {$\_.IPaddress -like “10.\*”}  
Get-WmiObject Win32\_bios -ComputerName $name | Select serialnumber

---

<div class="post-metadata">

**Author:** ![bkindle](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/bkindle/32/95_2.png) [@bkindle](https://forums.powershell.org/u/bkindle)\
**Post date:** [February 20, 2019, 8:21am UTC](https://forums.powershell.org/t/dhcp-scope-name/12064/2 "2019-02-20T08:21:34Z")

</div>

There are two different cmdlets you’ll want to read up on:

```
Help Get-ADcomputer -Full
```

and

```
Help Get-DHCPServerv4Scope -Full
```

---

<div class="post-metadata">

**Author:** ![mikedavidson1975](https://avatars.discourse-cdn.com/v4/letter/m/e8c25b/32.png) [@mikedavidson1975](https://forums.powershell.org/u/mikedavidson1975)\
**Post date:** [February 20, 2019, 9:49am UTC](https://forums.powershell.org/t/dhcp-scope-name/12064/3 "2019-02-20T09:49:29Z")

</div>

Thank you, I have been reading through those and testing different parts. The main issue that I cannot resolve is the following:

Get-WmiObject Win32\_NetworkAdapterConfiguration -ComputerName $name | Select IPAddress | Where-Object {$\_.IPaddress -like “10.\*”}

This will give me back an IP address, but what I am not sure how to do is to take the 2nd octet of the output (such as 49) and have a table that will output this octet as a location name.

Even if it meant that the IP address was displayed and I was then prompted to enter it on a new line such as :

$IPAddress = Read-Host -Prompt “What is the IP Address?”

&nbsp;

&nbsp;

---

<div class="post-metadata">

**Author:** ![adam-mcgill-2](https://avatars.discourse-cdn.com/v4/letter/a/b3f665/32.png) [@adam-mcgill-2](https://forums.powershell.org/u/adam-mcgill-2)\
**Post date:** [February 20, 2019, 10:10am UTC](https://forums.powershell.org/t/dhcp-scope-name/12064/4 "2019-02-20T10:10:37Z")

</div>

If you know the Second Octs, you could use a switch to specify the location name, example below.

[pre]  
$All = @()  
Get-WmiObject Win32\_NetworkAdapterConfiguration -ComputerName $name | Select IPAddress | Where-Object {$_.IPaddress -like “10.\*”} |  
ForEach-Object {  
$IP = ($_.IPAddress).Split(‘.’)

switch ($IP[1])  
{  
49 { $Location = “Canada” }

default { $Location = “Other” }  
}

$obj = New-Object –typename PSObject  
$obj | Add-Member –membertype NoteProperty –name ‘Computer’ –value (“$name”) –PassThru |  
Add-Member –membertype NoteProperty –name ‘IPAddress’ –value (“$($\_.IPAddress)”) –PassThru |  
Add-Member –membertype NoteProperty –name ‘Location’ –value (“$Location”)  
$All += $obj  
}

$All

[/pre]

---

<div class="post-metadata">

**Author:** ![Olaf](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/olaf/32/992_2.png) [@Olaf](https://forums.powershell.org/u/Olaf)\
**Post date:** [February 20, 2019, 10:16am UTC](https://forums.powershell.org/t/dhcp-scope-name/12064/5 "2019-02-20T10:16:26Z")

</div>

I’d recomend to tread an IP address as IP address … I think it’s more professional, easier to read and to understand and probably more reliable … 😉

```
([IPADDRESS]‘192.168.2.1’).getAddressbytes()[1]
```

---

<div class="post-metadata">

**Author:** ![adam-mcgill-2](https://avatars.discourse-cdn.com/v4/letter/a/b3f665/32.png) [@adam-mcgill-2](https://forums.powershell.org/u/adam-mcgill-2)\
**Post date:** [February 20, 2019, 10:41am UTC](https://forums.powershell.org/t/dhcp-scope-name/12064/6 "2019-02-20T10:41:12Z")

</div>

I agree Olaf, also I had to add the Trim to the line as $\_.IPaddress / Convert error (System.string to System.net.Ipaddress). Spaces in the string cause the error.

[pre]

$All = @()  
Get-WmiObject Win32\_NetworkAdapterConfiguration -ComputerName $name | Select IPAddress | Where-Object {$\_.IPaddress -like “10.\*”} |  
ForEach-Object {

$IPLoc = ([IPADDRESS]$\_.IPaddress.Trim()).getAddressbytes()[1]

switch ($IPLoc){  
49 { $Location = “Canada” }

default { $Location = “Other” }  
}

$obj = New-Object –typename PSObject  
$obj | Add-Member –membertype NoteProperty –name ‘Computer’ –value (“$name”) –PassThru |  
Add-Member –membertype NoteProperty –name ‘IPAddress’ –value (“$($\_.IPAddress)”) –PassThru |  
Add-Member –membertype NoteProperty –name ‘Location’ –value (“$Location”)  
$All += $obj  
}

$All

[/pre]

&nbsp;

---

<div class="post-metadata">

**Author:** ![mikedavidson1975](https://avatars.discourse-cdn.com/v4/letter/m/e8c25b/32.png) [@mikedavidson1975](https://forums.powershell.org/u/mikedavidson1975)\
**Post date:** [February 20, 2019, 10:51am UTC](https://forums.powershell.org/t/dhcp-scope-name/12064/7 "2019-02-20T10:51:43Z")

</div>

This is almost perfect. It is working, except when I run it, it displays all of the script before output?

Like this:

PS H:\\> #$name = Read-Host -Prompt "What is the name of the computer?" $All = @() Get-WmiObject Win32\_NetworkAdapterConfiguration -ComputerName $name | Select IPAddress | Where-Object {$\_.IPaddress -like "10.\*"} | ForEach-Object { $IP = ($\_.IPAddress).Split('.')

switch ($IP[1]) { 41 { $Location = "Canada" }

default { $Location = "Other" } }

$obj = New-Object –typename PSObject $obj | Add-Member –membertype NoteProperty –name 'Computer' –value ("$name") –PassThru | Add-Member –membertype NoteProperty –name 'IPAddress' –value ("$($\_.IPAddress)") –PassThru | Add-Member –membertype NoteProperty –name 'Location' –value ("$Location") $All += $obj }

$All

Computer IPAddress Location -------- --------- -------- xxxx 10.41.xx.xx fe80::d453:2bd6:8d19:64dc Canada 

PS H:\\>

---

<div class="post-metadata">

**Author:** ![mikedavidson1975](https://avatars.discourse-cdn.com/v4/letter/m/e8c25b/32.png) [@mikedavidson1975](https://forums.powershell.org/u/mikedavidson1975)\
**Post date:** [February 20, 2019, 10:54am UTC](https://forums.powershell.org/t/dhcp-scope-name/12064/8 "2019-02-20T10:54:10Z")

</div>

I agree, but this is more used in regard to asset management so each 2nd octet is a different geographical location, more used to know which office to ring based upon IP address 🙂

---

<div class="post-metadata">

**Author:** ![adam-mcgill-2](https://avatars.discourse-cdn.com/v4/letter/a/b3f665/32.png) [@adam-mcgill-2](https://forums.powershell.org/u/adam-mcgill-2)\
**Post date:** [February 20, 2019, 11:13am UTC](https://forums.powershell.org/t/dhcp-scope-name/12064/9 "2019-02-20T11:13:44Z")

</div>

How are you running the code MikeDavidson1975 ?

If you are running the code for example in the PowerShell ISE, run the code it will display like you said all the code and then the result.

If you save the code to a file and then run the code it will only display the result.

You could also add a CLS at the top of the code if you want also.

---

<div class="post-metadata">

**Author:** ![mikedavidson1975](https://avatars.discourse-cdn.com/v4/letter/m/e8c25b/32.png) [@mikedavidson1975](https://forums.powershell.org/u/mikedavidson1975)\
**Post date:** [February 20, 2019, 11:14am UTC](https://forums.powershell.org/t/dhcp-scope-name/12064/10 "2019-02-20T11:14:43Z")

</div>

Thanks Adam, this is working great now!

---

<div class="post-metadata">

**Author:** ![mikedavidson1975](https://avatars.discourse-cdn.com/v4/letter/m/e8c25b/32.png) [@mikedavidson1975](https://forums.powershell.org/u/mikedavidson1975)\
**Post date:** [February 20, 2019, 11:32am UTC](https://forums.powershell.org/t/dhcp-scope-name/12064/11 "2019-02-20T11:32:37Z")

</div>

My bad. Too long sat in front of screen - forgot to save, rookie mistake. Now I just need to input 200 subnets…thanks again

---

<div class="post-metadata">

**Author:** ![bkindle](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/bkindle/32/95_2.png) [@bkindle](https://forums.powershell.org/u/bkindle)\
**Post date:** [February 20, 2019, 12:14pm UTC](https://forums.powershell.org/t/dhcp-scope-name/12064/12 "2019-02-20T12:14:57Z")

</div>

Turn this into an advanced function and you could feed your subnets and other parameters as a file or variable saved from another query.

&nbsp;

glad you got this working!

---

<div class="post-metadata">

**Author:** ![mikedavidson1975](https://avatars.discourse-cdn.com/v4/letter/m/e8c25b/32.png) [@mikedavidson1975](https://forums.powershell.org/u/mikedavidson1975)\
**Post date:** [February 21, 2019, 7:18am UTC](https://forums.powershell.org/t/dhcp-scope-name/12064/13 "2019-02-21T07:18:29Z")

</div>

So from the following:

Get-WmiObject Win32\_NetworkAdapterConfiguration -ComputerName $name | Select IPAddress | Where-Object {$\_.IPaddress -like "10.\*"} | ForEach-Object { $IP = ($\_.IPAddress).Split('.')

switch ($IP[1]) { 41 { $Location = "Oakpark" }

default { $Location = "Other" } }

$obj = New-Object –typename PSObject $obj | Add-Member –membertype NoteProperty –name 'Computer' –value ("$name") –PassThru | Add-Member –membertype NoteProperty –name 'IPAddress' –value ("$($\_.IPAddress)") –PassThru | Add-Member –membertype NoteProperty –name 'Location' –value ("$Location") $All += $obj }

$All

Is it possible to break this into 2nd and 3rd octets, so that I could get results as follows?:

x.62.100.x = Town A Staff Subnet

x.62.200.x = Town A Student Subnet

x.64.100.x = Town B Staff Subnet

etc...

---

<div class="post-metadata">

**Author:** ![adam-mcgill-2](https://avatars.discourse-cdn.com/v4/letter/a/b3f665/32.png) [@adam-mcgill-2](https://forums.powershell.org/u/adam-mcgill-2)\
**Post date:** [February 21, 2019, 2:27pm UTC](https://forums.powershell.org/t/dhcp-scope-name/12064/14 "2019-02-21T14:27:17Z")

</div>

Turned the code into a function so you can pass in the computer objects, comment out some ways to do that by inputting static objects or reading Active Directory itself. If you are going to use Active Directory module, uncomment out the import and confirm you are able to use the Cmdlet (RSAT installed), Hope this is what you are looking for,

[pre]

CLS

## Import-Module ActiveDirectory

## Input static computer obejcts

## $Computers = @(“Computer1”,“Computer2”)

## 

## Using Active Directory to pull computer objects, filter can be adjusted along with using the property Name or DNSHostName

## 

## [string]$ADFilter = ‘OperatingSystem -Like “Windows _Server_” -and enabled -eq $true’

## $ADResults = (Get-ADComputer -Filter $ADFilter -Properties Name,DNSHostName | Select-Object Name,DNSHostName | Sort-Object Name).Name ## Can switch between Name or DNSHostName

function Get-NetworkLocationUser  
{  
Param ($Computers)  
$All = @()

foreach ($Computer in $Computers)  
{  
Get-WmiObject Win32\_NetworkAdapterConfiguration -ComputerName $Computer | Select IPAddress | Where-Object {$\_.IPaddress -like “10.\*”} |  
ForEach-Object {

$IPLoc = ([IPADDRESS]$\_.IPaddress.Trim()).getAddressbytes()[1]  
switch ($IPLoc){  
62 { $Location = “A” }  
64 { $Location = “B” }  
default { $Location = “Other” }  
}

$IPUser = ([IPADDRESS]$\_.IPaddress.Trim()).getAddressbytes()[2]  
switch ($IPUser){  
100 { $User = “Staff” }  
200 { $User = “Student” }  
default { $User = “Other” }  
}

$obj = New-Object –typename PSObject  
$obj | Add-Member –membertype NoteProperty –name ‘Computer’ –value (“$name”) –PassThru |  
Add-Member –membertype NoteProperty –name ‘IPAddress’ –value (“$($\_.IPAddress)”) –PassThru |  
Add-Member –membertype NoteProperty –name ‘Location’ –value (“$Location”) –PassThru |  
Add-Member –membertype NoteProperty –name ‘User’ –value (“$User”)  
$All += $obj  
}  
}  
return $All  
} Get-NetworkLocationUser -Computers $Computers

[/pre]

---

<div class="post-metadata">

**Author:** ![adam-mcgill-2](https://avatars.discourse-cdn.com/v4/letter/a/b3f665/32.png) [@adam-mcgill-2](https://forums.powershell.org/u/adam-mcgill-2)\
**Post date:** [February 21, 2019, 2:30pm UTC](https://forums.powershell.org/t/dhcp-scope-name/12064/15 "2019-02-21T14:30:45Z")

</div>

Is this what you are looking for? Turned the code into a function also.

[pre]

CLS

## Input static computer obejcts

## $Computers = @(“Computer1”,“Computer2”)

## 

## Using Active Directory to pull computer objects, filter can be adjusted along with using the property Name or DNSHostName

## Import-Module ActiveDirectory

## [string]$ADFilter = ‘OperatingSystem -Like “Windows _Server_” -and enabled -eq $true’

## $ADResults = (Get-ADComputer -Filter $ADFilter -Properties Name,DNSHostName | Select-Object Name,DNSHostName | Sort-Object Name).Name ## Can switch between Name or DNSHostName

function Get-NetworkLocationUser  
{  
Param ($Computers)  
$All = @()

foreach ($Computer in $Computers)  
{  
Get-WmiObject Win32\_NetworkAdapterConfiguration -ComputerName $Computer | Select IPAddress | Where-Object {$\_.IPaddress -like “10.\*”} |  
ForEach-Object {

$IPLoc = ([IPADDRESS]$\_.IPaddress.Trim()).getAddressbytes()[1]  
switch ($IPLoc){  
62 { $Location = “A” }  
64 { $Location = “B” }  
default { $Location = “Other” }  
}

$IPUser = ([IPADDRESS]$\_.IPaddress.Trim()).getAddressbytes()[2]  
switch ($IPUser){  
100 { $User = “Staff” }  
200 { $User = “Student” }  
default { $User = “Other” }  
}

$obj = New-Object –typename PSObject  
$obj | Add-Member –membertype NoteProperty –name ‘Computer’ –value (“$name”) –PassThru |  
Add-Member –membertype NoteProperty –name ‘IPAddress’ –value (“$($\_.IPAddress)”) –PassThru |  
Add-Member –membertype NoteProperty –name ‘Location’ –value (“$Location”) –PassThru |  
Add-Member –membertype NoteProperty –name ‘User’ –value (“$User”)  
$All += $obj  
}  
}  
return $All  
} Get-NetworkLocationUser -Computers $Computers

[/pre]

---

<div class="post-metadata">

**Author:** ![mikedavidson1975](https://avatars.discourse-cdn.com/v4/letter/m/e8c25b/32.png) [@mikedavidson1975](https://forums.powershell.org/u/mikedavidson1975)\
**Post date:** [February 22, 2019, 6:32am UTC](https://forums.powershell.org/t/dhcp-scope-name/12064/16 "2019-02-22T06:32:42Z")

</div>

Its getting there…

[pre]Cannot convert the "System.Object[]" value of type "System.Object[]" to type "System.Net.IPAddress". At \\opvx341\homeshares$\Mike.Davidson\Powershell Scripts\test2.ps1:22 char:1 + $IPLoc = ([IPADDRESS]$\_.IPaddress.Trim()).getAddressbytes()[1] + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ CategoryInfo : InvalidArgument: (:) [], RuntimeException + FullyQualifiedErrorId : ConvertToFinalInvalidCastExceptionCannot convert the "System.Object[]" value of type "System.Object[]" to type "System.Net.IPAddress". At \\opvx341\homeshares$\Mike.Davidson\Powershell Scripts\test2.ps1:29 char:1 + $IPUser = ([IPADDRESS]$\_.IPaddress.Trim()).getAddressbytes()[2] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidArgument: (:) [], RuntimeException + FullyQualifiedErrorId : ConvertToFinalInvalidCastException

Computer IPAddress Location User -------- --------- -------- ---- tgnx2244 10.41.101.81 fe80::d453:2bd6:8d19:64dc Other Other

[/pre]

I have changed the following as well, so Location should = A, User should = Staff

[pre]

$IPLoc = ([IPADDRESS]$\_.IPaddress.Trim()).getAddressbytes()[1] switch ($IPLoc){ 41 { $Location = "A" } 64 { $Location = "B" } default { $Location = "Other" } }

$IPUser = ([IPADDRESS]$\_.IPaddress.Trim()).getAddressbytes()[2] switch ($IPUser){ 101 { $User = "Staff" } 200 { $User = "Student" } default { $User = "Other" } }

[/pre]

---

<div class="post-metadata">

**Author:** ![mikedavidson1975](https://avatars.discourse-cdn.com/v4/letter/m/e8c25b/32.png) [@mikedavidson1975](https://forums.powershell.org/u/mikedavidson1975)\
**Post date:** [February 22, 2019, 6:36am UTC](https://forums.powershell.org/t/dhcp-scope-name/12064/17 "2019-02-22T06:36:06Z")

</div>

#### It is nearly working. Changed octet 2 and 3 values to match my IP but still getting issues:

```
Cannot convert the "System.Object[]" value of type "System.Object[]" to type "System.Net.IPAddress". At \\xxx\Powershell Scripts\test2.ps1:22 char:1 + $IPLoc = ([IPADDRESS]$\_.IPaddress.Trim()).getAddressbytes()[1] + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidArgument: (:) [], RuntimeException + FullyQualifiedErrorId : ConvertToFinalInvalidCastException
```

```
Cannot convert the "System.Object[]" value of type "System.Object[]" to type "System.Net.IPAddress".
At \\xxx\Powershell Scripts\test2.ps1:29 char:1
+ $IPUser = ([IPADDRESS]$_.IPaddress.Trim()).getAddressbytes()[2]
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [], RuntimeException
+ FullyQualifiedErrorId : ConvertToFinalInvalidCastException
```

```
Computer IPAddress Location User

* * *

tgnx2244 10.41.101.81 fe80::d453:2bd6:8d19:64dc Other Other
```

---

<div class="post-metadata">

**Author:** ![mikedavidson1975](https://avatars.discourse-cdn.com/v4/letter/m/e8c25b/32.png) [@mikedavidson1975](https://forums.powershell.org/u/mikedavidson1975)\
**Post date:** [February 22, 2019, 6:39am UTC](https://forums.powershell.org/t/dhcp-scope-name/12064/18 "2019-02-22T06:39:56Z")

</div>

Thanks for the help, I am still getting an issue even after changing octets 2 and 3 to match my IP:

```
Cannot convert the "System.Object[]" value of type "System.Object[]" to type "System.Net.IPAddress". At \\xxx\Powershell Scripts\test2.ps1:22 char:1 + $IPLoc = ([IPADDRESS]$\_.IPaddress.Trim()).getAddressbytes()[1] + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ CategoryInfo : InvalidArgument: (:) [], RuntimeException + FullyQualifiedErrorId : ConvertToFinalInvalidCastException Cannot convert the "System.Object[]" value of type "System.Object[]" to type "System.Net.IPAddress". At \\xxx\Powershell Scripts\test2.ps1:29 char:1 + $IPUser = ([IPADDRESS]$\_.IPaddress.Trim()).getAddressbytes()[2] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidArgument: (:) [], RuntimeException + FullyQualifiedErrorId : ConvertToFinalInvalidCastException Computer IPAddress Location User -------- --------- -------- ---- tgnx2244 10.41.101.81 fe80::d453:2bd6:8d19:64dc Other Other
```

---

<div class="post-metadata">

**Author:** ![mikedavidson1975](https://avatars.discourse-cdn.com/v4/letter/m/e8c25b/32.png) [@mikedavidson1975](https://forums.powershell.org/u/mikedavidson1975)\
**Post date:** [February 22, 2019, 8:39am UTC](https://forums.powershell.org/t/dhcp-scope-name/12064/19 "2019-02-22T08:39:43Z")

</div>

Hi Adam

I’ve been trying your script with some success, but i’m not pulling my hair out and have stripped it back to a very basic script. I have tested all parts individually as working and have included the stripped down script. By the way, the PC I am querying has IP 10.41.101.x

This is the response:

What is the name of the computer?: tgnx2244  
cmdlet Add-Member at command pipeline position 1  
Supply values for the following parameters:  
InputObject:

&nbsp;

Here is the script:

cls $name = Read-Host -Prompt "What is the name of the computer?" $All = @() Get-WmiObject Win32\_NetworkAdapterConfiguration -ComputerName $name | Select IPAddress | Where-Object {$\_.IPaddress -like "10.\*"} | ForEach-Object { $IP = ($\_.IPAddress).Split('.')

switch ($IP[1]) { 41 { $Location = "xxx" } 101 { $Location = "Staff VLAN" }

default { $Location = "Other" } }

switch ($IP[2]) { 41 { $Location2 = "xxx" } 101 { $Location2 = "Staff VLAN" }

default { $Location2 = "Other" } }

$obj = New-Object –typename PSObject $obj | Add-Member –membertype NoteProperty –name 'Computer' –value ("$name") –PassThru | Add-Member –membertype NoteProperty –name 'IPAddress' –value ("$($\_.IPAddress)") –PassThru | Add-Member –membertype NoteProperty –name 'Location' –value ("$Location") Add-Member –membertype NoteProperty –name 'Location2' –value ("$Location2") $All += $obj }

$All

---

<div class="post-metadata">

**Author:** ![adam-mcgill-2](https://avatars.discourse-cdn.com/v4/letter/a/b3f665/32.png) [@adam-mcgill-2](https://forums.powershell.org/u/adam-mcgill-2)\
**Post date:** [February 22, 2019, 8:44am UTC](https://forums.powershell.org/t/dhcp-scope-name/12064/20 "2019-02-22T08:44:18Z")

</div>

Missing –PassThru |at the end of the line for $Location.

&nbsp;

&nbsp;

[Next page](https://forums.powershell.org/t/dhcp-scope-name/12064.md?page=2)
