How to set a static IP address in windows 10?powershell: exit doesn't really exitHow to effectively use the `-Filter` parameter on Active Directory cmdlets?Setting Windows PowerShell environment variablesHow to pass an argument to a PowerShell script?How do you comment out code in PowerShell?How does Windows 8 Runtime (WinRT / Windows Store apps / Windows 10 Universal App) compare to Silverlight and WPF?Setting x:DeferLoadStrategy in code behindCoded UI - How to bring in focus when a new IE window opens?How to enable Windows Authentication on a Windows Server 2012 IIS website using Powershell?Can you set up a static IP addressHow can I set the “Environment” > “Start the following program at logon” property on a local user using powershell?Can I control Windows Setting Focus Assist (On/Off) in my WPF Project
Are double contractions formal? Eg: "couldn't've" for "could not have"
What is a good way to allow only one non null field in an object
Is it a Munchausen Number?
What replaces x86 intrinsics for C when Apple ditches Intel CPUs for their own chips?
Two (probably) equal real numbers which are not proved to be equal?
How long can fsck take on a 30 TB volume?
How is it possible for this circuit to continue functioning correctly?
Thawing Glaciers return to hand interaction
Employee is self-centered and affects the team negatively
Does Thread.yield() do anything if we have enough processors to service all threads?
What dice to use in a game that revolves around triangles?
Names of the Six Tastes
How can I test a shell script in a "safe environment" to avoid harm to my computer?
Double underlining a result in a system of equations with calculation steps on the right side
resoldering copper waste pipe
Is there any evidence to support the claim that the United States was "suckered into WW1" by Zionists, made by Benjamin Freedman in his 1961 speech
Is there an idiom that means "revealing a secret unintentionally"?
Are wands in any sort of book going to be too much like Harry Potter?
Why does the electron wavefunction not collapse within atoms at room temperature in gas, liquids or solids due to decoherence?
Is there an application which does HTTP PUT?
Can a planet still function with a damaged moon?
Program for finding longest run of zeros from a list of 100 random integers which are either 0 or 1
Do Rabbis admit emotional involvement in their rulings?
Metric of positive curvature and Homology group
How to set a static IP address in windows 10?
powershell: exit doesn't really exitHow to effectively use the `-Filter` parameter on Active Directory cmdlets?Setting Windows PowerShell environment variablesHow to pass an argument to a PowerShell script?How do you comment out code in PowerShell?How does Windows 8 Runtime (WinRT / Windows Store apps / Windows 10 Universal App) compare to Silverlight and WPF?Setting x:DeferLoadStrategy in code behindCoded UI - How to bring in focus when a new IE window opens?How to enable Windows Authentication on a Windows Server 2012 IIS website using Powershell?Can you set up a static IP addressHow can I set the “Environment” > “Start the following program at logon” property on a local user using powershell?Can I control Windows Setting Focus Assist (On/Off) in my WPF Project
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
After searching a code to set a static IP adress using a simple script, I could not find a complete and easy to implement answer on StackOverflow. That led me to the following question:
What would be an "easy^"-to-implement code to set your windows 10 IP adress to a static IP adress, and back to a dynamic IP adress again?
^ Note: Easy is meant as an indicator to ensure the code and its complete implementation is as simple as possible, not that the user could not find it challenging.
powershell automation windows-10 static-ip-address
add a comment |
After searching a code to set a static IP adress using a simple script, I could not find a complete and easy to implement answer on StackOverflow. That led me to the following question:
What would be an "easy^"-to-implement code to set your windows 10 IP adress to a static IP adress, and back to a dynamic IP adress again?
^ Note: Easy is meant as an indicator to ensure the code and its complete implementation is as simple as possible, not that the user could not find it challenging.
powershell automation windows-10 static-ip-address
1
@Bill_Stewart The question is how to set a static IP in Windows 10, but it's terribly stated. This is a Q&A question.
– TheIncorrigible1
Jul 10 '18 at 19:57
1
Please restate the question as an actual question. Here's an example where I posed a question I already knew the answer to, and then answered it.
– Bender the Greatest
Jul 10 '18 at 21:32
Thank you for your comments, the question was indeed not formulated properly. I have adapted the question to include the complete and explicit question in the body of the "question-text" of this post. I appreciate the example of an implementation of your suggestion @BendertheGreatest.
– a.t.
Jul 11 '18 at 8:36
add a comment |
After searching a code to set a static IP adress using a simple script, I could not find a complete and easy to implement answer on StackOverflow. That led me to the following question:
What would be an "easy^"-to-implement code to set your windows 10 IP adress to a static IP adress, and back to a dynamic IP adress again?
^ Note: Easy is meant as an indicator to ensure the code and its complete implementation is as simple as possible, not that the user could not find it challenging.
powershell automation windows-10 static-ip-address
After searching a code to set a static IP adress using a simple script, I could not find a complete and easy to implement answer on StackOverflow. That led me to the following question:
What would be an "easy^"-to-implement code to set your windows 10 IP adress to a static IP adress, and back to a dynamic IP adress again?
^ Note: Easy is meant as an indicator to ensure the code and its complete implementation is as simple as possible, not that the user could not find it challenging.
powershell automation windows-10 static-ip-address
powershell automation windows-10 static-ip-address
edited Dec 3 '18 at 1:45
Alex Bravo
8561434
8561434
asked Jul 10 '18 at 19:46
a.t.a.t.
398316
398316
1
@Bill_Stewart The question is how to set a static IP in Windows 10, but it's terribly stated. This is a Q&A question.
– TheIncorrigible1
Jul 10 '18 at 19:57
1
Please restate the question as an actual question. Here's an example where I posed a question I already knew the answer to, and then answered it.
– Bender the Greatest
Jul 10 '18 at 21:32
Thank you for your comments, the question was indeed not formulated properly. I have adapted the question to include the complete and explicit question in the body of the "question-text" of this post. I appreciate the example of an implementation of your suggestion @BendertheGreatest.
– a.t.
Jul 11 '18 at 8:36
add a comment |
1
@Bill_Stewart The question is how to set a static IP in Windows 10, but it's terribly stated. This is a Q&A question.
– TheIncorrigible1
Jul 10 '18 at 19:57
1
Please restate the question as an actual question. Here's an example where I posed a question I already knew the answer to, and then answered it.
– Bender the Greatest
Jul 10 '18 at 21:32
Thank you for your comments, the question was indeed not formulated properly. I have adapted the question to include the complete and explicit question in the body of the "question-text" of this post. I appreciate the example of an implementation of your suggestion @BendertheGreatest.
– a.t.
Jul 11 '18 at 8:36
1
1
@Bill_Stewart The question is how to set a static IP in Windows 10, but it's terribly stated. This is a Q&A question.
– TheIncorrigible1
Jul 10 '18 at 19:57
@Bill_Stewart The question is how to set a static IP in Windows 10, but it's terribly stated. This is a Q&A question.
– TheIncorrigible1
Jul 10 '18 at 19:57
1
1
Please restate the question as an actual question. Here's an example where I posed a question I already knew the answer to, and then answered it.
– Bender the Greatest
Jul 10 '18 at 21:32
Please restate the question as an actual question. Here's an example where I posed a question I already knew the answer to, and then answered it.
– Bender the Greatest
Jul 10 '18 at 21:32
Thank you for your comments, the question was indeed not formulated properly. I have adapted the question to include the complete and explicit question in the body of the "question-text" of this post. I appreciate the example of an implementation of your suggestion @BendertheGreatest.
– a.t.
Jul 11 '18 at 8:36
Thank you for your comments, the question was indeed not formulated properly. I have adapted the question to include the complete and explicit question in the body of the "question-text" of this post. I appreciate the example of an implementation of your suggestion @BendertheGreatest.
– a.t.
Jul 11 '18 at 8:36
add a comment |
2 Answers
2
active
oldest
votes
Please note that this is the implementation of: http://www.midnightdba.com/Jen/2014/03/configure-static-or-dynamic-ip-and-dns-with-powershell/. All credits go to MidnightDBA. I hope it benefits someone!
To set the IP adress to static manually
Start>control panel>Network and Internet>Network and Sharing Center>Change adapter settings>rmb on the ethernet/wifi/connection that is in use>properties>Select: Internet Protocol Version 4(TCP/IPv4)>Properties>That should result in the screen similar to the attached image. There you can fill in the numbers manually. These numbers will (probably) be different in your own situation, you need to do the work suggested in note 3. to determine those numbers for yourself.

To set the static IP (semi-automatically):
This means you will be able to to set the IP address to static by opening a file (double clicking a script you've made), and back to a dynamic IP address by running another script you've made. The instruction steps are listed below:
start>type Powershell>rmb>Open powershell as administrator- (Only do this step if you can not immediately run the script the first time.) Type:
Set-ExecutionPolicy RemoteSigned -Scope CurrentUserand hit enter, to set the security policy so that you can run a powershell script. create a
.ps1file named e.g.static_ip.ps1in for examplec:/example_folderwith the content:$wmi = Get-WmiObject win32_networkadapterconfiguration -filter "ipenabled ='true'";
$wmi.EnableStatic("your_static_ip_adress", "your_subnetmask");
$wmi.SetGateways("your_routers_ip_adress", 1);
$wmi.SetDNSServerSearchOrder("your_dns");OR to set the static IP with just a single double click on the
static_ip.ps1script:
(Note example values filled in)# 18-07-20 Todo: add wifi network detection that automatically triggers setting a static IP and back dynamic IP.
# First ensure the script is automatically ran as administrator, else it appearently does not have the privileges to change the local IP adress:
$currentUser = New-Object Security.Principal.WindowsPrincipal $([Security.Principal.WindowsIdentity]::GetCurrent())
$testadmin = $currentUser.IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator)
if ($testadmin -eq $false)
Start-Process powershell.exe -Verb RunAs -ArgumentList ('-noprofile -noexit -file "0" -elevated' -f ($myinvocation.MyCommand.Definition))
exit $LASTEXITCODE
# Next set it static:
$wmi.EnableStatic("192.21.89.5", "255.255.254.0");
$wmi.SetGateways("192.21.89.1", 1);
$wmi.SetDNSServerSearchOrder("192.21.89.1");
# Now close the window this has just created.
# This leaves other Powershell windows open if they were already open before you ran this script.
# Also, It yields an error with a $ sign at the start of the line.
# Source: https://stackoverflow.com/questions/14874619/powershell-exit-doesnt-really-exit
Stop-Process -Id $PIDThen in powershell enter:
cd c:/example_folder
.static_ip.ps1Note, if the path to the
static_ip.ps1file contains a space change thechange directory-command to:cd "c:/example_folder"
To make the IP dynamic again (semi-automatically):
Create a text file named for example
dynamic_ip.ps1located e.g. in folderc:/examplefolderwith content:$wmi = Get-WmiObject win32_networkadapterconfiguration -filter "ipenabled ='true'";
$wmi.EnableDHCP();
$wmi.SetDNSServerSearchOrder();OR to just change it with a single double-click on the
dynamic_ip.ps1script:#18-07-20 Todo: add wifi network detection that automatically triggers setting a static IP and back dynamic IP.
# First ensure the script is automatically ran as administrator, else it appearently does not have the privileges to change the local IP adress:
$currentUser = New-Object Security.Principal.WindowsPrincipal $([Security.Principal.WindowsIdentity]::GetCurrent())
$testadmin = $currentUser.IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator)
if ($testadmin -eq $false)
Start-Process powershell.exe -Verb RunAs -ArgumentList ('-noprofile -noexit -file "0" -elevated' -f ($myinvocation.MyCommand.Definition))
exit $LASTEXITCODE
# Next set it dynamic:
$wmi = Get-WmiObject win32_networkadapterconfiguration -filter "ipenabled ='true'";
$wmi.EnableDHCP();
$wmi.SetDNSServerSearchOrder();
# Now close the window this has just created.
# This leaves other Powershell windows open if they were already open before you ran this script.
# Also, It yields an error with a $ sign at the start of the line.
# Source: https://stackoverflow.com/questions/14874619/powershell-exit-doesnt-really-exit
Stop-Process -Id $PIDIn powershell:
cd c:/example_folder
.dynamic_ip.ps1
After you have tried it out the first time in powershell succesfully, you can simply set a static IP adress by opening/running the script by opening it with powershell (In explorer, double click the file, or right mouse button (rmb)>open with powershell). But for this to work, the path to the scripts cannot contain any spaces!
Additional notes:
Do not forget to make the IP adress dynamic again if you leave your home network again, otherwise you can get a problem when you try to access the internet in other wifi/ethernet networks!
your_static_ip_adress: you can read your dynamic ip adress and routers ip adress by:start>type cmd>open command prompt>type: ipconfig, or type:ipconfig -all.* Furthermore, the rules described in the note above, generally apply.your_routers_ip_adresssee "your_static_ip_adress", usually ends with a.1your_subnetmasksee "your_static_ip_adress"your_dns, this can be your routers ip adress, or for example googles DNS8.8.8.8.Rules to determine the static IP adres:
Source:
https://www.howtogeek.com/184310/ask-htg-should-i-be-setting-static-ip-addresses-on-my-router/3.1 Do not assign an address that ends in .0 or .255 as these addresses are typically reserved for network protocols.
3.2 Do not assign an address to the very start of the IP pool, e.g. 10.0.0.1 as the start address is always reserved for the router. Even if you’ve changed the IP address of your router for security purposes, we’d still suggest against assigning a computer.
3.3 Do not assign an address outside of the total available pool of private IP addresses. This means if your router’s pool is 10.0.0.0 through 10.255.255.255 every IP you assign (keeping in mind the prior two rules) should fall within that range.
This is the (semi) automated equivalent of manually filling in the data of the first figure of this post, in order to set a static IP.
(Wifi connection issues troubleshoot) If:
- you have 2 different wifi networks (
AandB) to which you can both connect at the same location - where only
Bhas the right"your_routers_ip_adress"/local gateway-adress - And you accidentally set your
local IPto (the wrong)static IPwhilst connect to the wrong wifi (A), - Then disconnected the wrong wifi (
A) before setting thelocal IPadress to dynamic again, and (as a consequence) experience wifi troubles: (keeps
scanning network requirements).Then either:
set the
local IPadress todynamic.- Reconnect to the wrong wifi network (
A). - Set it back to
static, and todynamicagain. - Disconnect from wifi (
A). Now you should be able to connect to both wifi networks correct again.
Or:
set the
local IPadress tostatic.- Reconnect to the wrong wifi network (
A). - Set it back to
static, and todynamicagain. - Disconnect from wifi (
A). - Now you should be able to connect to both wifi networks correct again.
- you have 2 different wifi networks (
add a comment |
Nice information with GUI and PowerShell.
When you assign the IP manually by the PowerShell, the DNS server IP is important. Also, it can be done via the command prompt which is useful while managing the PCs remotely. The below post has the information. Maybe you can consider adding those steps in your post.
https://tinylaptop.net/how-to-configure-setup-static-ip-on-windows-10-laptop/
2
While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes.
– Rotemya
Mar 23 at 8:25
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f51272961%2fhow-to-set-a-static-ip-address-in-windows-10%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Please note that this is the implementation of: http://www.midnightdba.com/Jen/2014/03/configure-static-or-dynamic-ip-and-dns-with-powershell/. All credits go to MidnightDBA. I hope it benefits someone!
To set the IP adress to static manually
Start>control panel>Network and Internet>Network and Sharing Center>Change adapter settings>rmb on the ethernet/wifi/connection that is in use>properties>Select: Internet Protocol Version 4(TCP/IPv4)>Properties>That should result in the screen similar to the attached image. There you can fill in the numbers manually. These numbers will (probably) be different in your own situation, you need to do the work suggested in note 3. to determine those numbers for yourself.

To set the static IP (semi-automatically):
This means you will be able to to set the IP address to static by opening a file (double clicking a script you've made), and back to a dynamic IP address by running another script you've made. The instruction steps are listed below:
start>type Powershell>rmb>Open powershell as administrator- (Only do this step if you can not immediately run the script the first time.) Type:
Set-ExecutionPolicy RemoteSigned -Scope CurrentUserand hit enter, to set the security policy so that you can run a powershell script. create a
.ps1file named e.g.static_ip.ps1in for examplec:/example_folderwith the content:$wmi = Get-WmiObject win32_networkadapterconfiguration -filter "ipenabled ='true'";
$wmi.EnableStatic("your_static_ip_adress", "your_subnetmask");
$wmi.SetGateways("your_routers_ip_adress", 1);
$wmi.SetDNSServerSearchOrder("your_dns");OR to set the static IP with just a single double click on the
static_ip.ps1script:
(Note example values filled in)# 18-07-20 Todo: add wifi network detection that automatically triggers setting a static IP and back dynamic IP.
# First ensure the script is automatically ran as administrator, else it appearently does not have the privileges to change the local IP adress:
$currentUser = New-Object Security.Principal.WindowsPrincipal $([Security.Principal.WindowsIdentity]::GetCurrent())
$testadmin = $currentUser.IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator)
if ($testadmin -eq $false)
Start-Process powershell.exe -Verb RunAs -ArgumentList ('-noprofile -noexit -file "0" -elevated' -f ($myinvocation.MyCommand.Definition))
exit $LASTEXITCODE
# Next set it static:
$wmi.EnableStatic("192.21.89.5", "255.255.254.0");
$wmi.SetGateways("192.21.89.1", 1);
$wmi.SetDNSServerSearchOrder("192.21.89.1");
# Now close the window this has just created.
# This leaves other Powershell windows open if they were already open before you ran this script.
# Also, It yields an error with a $ sign at the start of the line.
# Source: https://stackoverflow.com/questions/14874619/powershell-exit-doesnt-really-exit
Stop-Process -Id $PIDThen in powershell enter:
cd c:/example_folder
.static_ip.ps1Note, if the path to the
static_ip.ps1file contains a space change thechange directory-command to:cd "c:/example_folder"
To make the IP dynamic again (semi-automatically):
Create a text file named for example
dynamic_ip.ps1located e.g. in folderc:/examplefolderwith content:$wmi = Get-WmiObject win32_networkadapterconfiguration -filter "ipenabled ='true'";
$wmi.EnableDHCP();
$wmi.SetDNSServerSearchOrder();OR to just change it with a single double-click on the
dynamic_ip.ps1script:#18-07-20 Todo: add wifi network detection that automatically triggers setting a static IP and back dynamic IP.
# First ensure the script is automatically ran as administrator, else it appearently does not have the privileges to change the local IP adress:
$currentUser = New-Object Security.Principal.WindowsPrincipal $([Security.Principal.WindowsIdentity]::GetCurrent())
$testadmin = $currentUser.IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator)
if ($testadmin -eq $false)
Start-Process powershell.exe -Verb RunAs -ArgumentList ('-noprofile -noexit -file "0" -elevated' -f ($myinvocation.MyCommand.Definition))
exit $LASTEXITCODE
# Next set it dynamic:
$wmi = Get-WmiObject win32_networkadapterconfiguration -filter "ipenabled ='true'";
$wmi.EnableDHCP();
$wmi.SetDNSServerSearchOrder();
# Now close the window this has just created.
# This leaves other Powershell windows open if they were already open before you ran this script.
# Also, It yields an error with a $ sign at the start of the line.
# Source: https://stackoverflow.com/questions/14874619/powershell-exit-doesnt-really-exit
Stop-Process -Id $PIDIn powershell:
cd c:/example_folder
.dynamic_ip.ps1
After you have tried it out the first time in powershell succesfully, you can simply set a static IP adress by opening/running the script by opening it with powershell (In explorer, double click the file, or right mouse button (rmb)>open with powershell). But for this to work, the path to the scripts cannot contain any spaces!
Additional notes:
Do not forget to make the IP adress dynamic again if you leave your home network again, otherwise you can get a problem when you try to access the internet in other wifi/ethernet networks!
your_static_ip_adress: you can read your dynamic ip adress and routers ip adress by:start>type cmd>open command prompt>type: ipconfig, or type:ipconfig -all.* Furthermore, the rules described in the note above, generally apply.your_routers_ip_adresssee "your_static_ip_adress", usually ends with a.1your_subnetmasksee "your_static_ip_adress"your_dns, this can be your routers ip adress, or for example googles DNS8.8.8.8.Rules to determine the static IP adres:
Source:
https://www.howtogeek.com/184310/ask-htg-should-i-be-setting-static-ip-addresses-on-my-router/3.1 Do not assign an address that ends in .0 or .255 as these addresses are typically reserved for network protocols.
3.2 Do not assign an address to the very start of the IP pool, e.g. 10.0.0.1 as the start address is always reserved for the router. Even if you’ve changed the IP address of your router for security purposes, we’d still suggest against assigning a computer.
3.3 Do not assign an address outside of the total available pool of private IP addresses. This means if your router’s pool is 10.0.0.0 through 10.255.255.255 every IP you assign (keeping in mind the prior two rules) should fall within that range.
This is the (semi) automated equivalent of manually filling in the data of the first figure of this post, in order to set a static IP.
(Wifi connection issues troubleshoot) If:
- you have 2 different wifi networks (
AandB) to which you can both connect at the same location - where only
Bhas the right"your_routers_ip_adress"/local gateway-adress - And you accidentally set your
local IPto (the wrong)static IPwhilst connect to the wrong wifi (A), - Then disconnected the wrong wifi (
A) before setting thelocal IPadress to dynamic again, and (as a consequence) experience wifi troubles: (keeps
scanning network requirements).Then either:
set the
local IPadress todynamic.- Reconnect to the wrong wifi network (
A). - Set it back to
static, and todynamicagain. - Disconnect from wifi (
A). Now you should be able to connect to both wifi networks correct again.
Or:
set the
local IPadress tostatic.- Reconnect to the wrong wifi network (
A). - Set it back to
static, and todynamicagain. - Disconnect from wifi (
A). - Now you should be able to connect to both wifi networks correct again.
- you have 2 different wifi networks (
add a comment |
Please note that this is the implementation of: http://www.midnightdba.com/Jen/2014/03/configure-static-or-dynamic-ip-and-dns-with-powershell/. All credits go to MidnightDBA. I hope it benefits someone!
To set the IP adress to static manually
Start>control panel>Network and Internet>Network and Sharing Center>Change adapter settings>rmb on the ethernet/wifi/connection that is in use>properties>Select: Internet Protocol Version 4(TCP/IPv4)>Properties>That should result in the screen similar to the attached image. There you can fill in the numbers manually. These numbers will (probably) be different in your own situation, you need to do the work suggested in note 3. to determine those numbers for yourself.

To set the static IP (semi-automatically):
This means you will be able to to set the IP address to static by opening a file (double clicking a script you've made), and back to a dynamic IP address by running another script you've made. The instruction steps are listed below:
start>type Powershell>rmb>Open powershell as administrator- (Only do this step if you can not immediately run the script the first time.) Type:
Set-ExecutionPolicy RemoteSigned -Scope CurrentUserand hit enter, to set the security policy so that you can run a powershell script. create a
.ps1file named e.g.static_ip.ps1in for examplec:/example_folderwith the content:$wmi = Get-WmiObject win32_networkadapterconfiguration -filter "ipenabled ='true'";
$wmi.EnableStatic("your_static_ip_adress", "your_subnetmask");
$wmi.SetGateways("your_routers_ip_adress", 1);
$wmi.SetDNSServerSearchOrder("your_dns");OR to set the static IP with just a single double click on the
static_ip.ps1script:
(Note example values filled in)# 18-07-20 Todo: add wifi network detection that automatically triggers setting a static IP and back dynamic IP.
# First ensure the script is automatically ran as administrator, else it appearently does not have the privileges to change the local IP adress:
$currentUser = New-Object Security.Principal.WindowsPrincipal $([Security.Principal.WindowsIdentity]::GetCurrent())
$testadmin = $currentUser.IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator)
if ($testadmin -eq $false)
Start-Process powershell.exe -Verb RunAs -ArgumentList ('-noprofile -noexit -file "0" -elevated' -f ($myinvocation.MyCommand.Definition))
exit $LASTEXITCODE
# Next set it static:
$wmi.EnableStatic("192.21.89.5", "255.255.254.0");
$wmi.SetGateways("192.21.89.1", 1);
$wmi.SetDNSServerSearchOrder("192.21.89.1");
# Now close the window this has just created.
# This leaves other Powershell windows open if they were already open before you ran this script.
# Also, It yields an error with a $ sign at the start of the line.
# Source: https://stackoverflow.com/questions/14874619/powershell-exit-doesnt-really-exit
Stop-Process -Id $PIDThen in powershell enter:
cd c:/example_folder
.static_ip.ps1Note, if the path to the
static_ip.ps1file contains a space change thechange directory-command to:cd "c:/example_folder"
To make the IP dynamic again (semi-automatically):
Create a text file named for example
dynamic_ip.ps1located e.g. in folderc:/examplefolderwith content:$wmi = Get-WmiObject win32_networkadapterconfiguration -filter "ipenabled ='true'";
$wmi.EnableDHCP();
$wmi.SetDNSServerSearchOrder();OR to just change it with a single double-click on the
dynamic_ip.ps1script:#18-07-20 Todo: add wifi network detection that automatically triggers setting a static IP and back dynamic IP.
# First ensure the script is automatically ran as administrator, else it appearently does not have the privileges to change the local IP adress:
$currentUser = New-Object Security.Principal.WindowsPrincipal $([Security.Principal.WindowsIdentity]::GetCurrent())
$testadmin = $currentUser.IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator)
if ($testadmin -eq $false)
Start-Process powershell.exe -Verb RunAs -ArgumentList ('-noprofile -noexit -file "0" -elevated' -f ($myinvocation.MyCommand.Definition))
exit $LASTEXITCODE
# Next set it dynamic:
$wmi = Get-WmiObject win32_networkadapterconfiguration -filter "ipenabled ='true'";
$wmi.EnableDHCP();
$wmi.SetDNSServerSearchOrder();
# Now close the window this has just created.
# This leaves other Powershell windows open if they were already open before you ran this script.
# Also, It yields an error with a $ sign at the start of the line.
# Source: https://stackoverflow.com/questions/14874619/powershell-exit-doesnt-really-exit
Stop-Process -Id $PIDIn powershell:
cd c:/example_folder
.dynamic_ip.ps1
After you have tried it out the first time in powershell succesfully, you can simply set a static IP adress by opening/running the script by opening it with powershell (In explorer, double click the file, or right mouse button (rmb)>open with powershell). But for this to work, the path to the scripts cannot contain any spaces!
Additional notes:
Do not forget to make the IP adress dynamic again if you leave your home network again, otherwise you can get a problem when you try to access the internet in other wifi/ethernet networks!
your_static_ip_adress: you can read your dynamic ip adress and routers ip adress by:start>type cmd>open command prompt>type: ipconfig, or type:ipconfig -all.* Furthermore, the rules described in the note above, generally apply.your_routers_ip_adresssee "your_static_ip_adress", usually ends with a.1your_subnetmasksee "your_static_ip_adress"your_dns, this can be your routers ip adress, or for example googles DNS8.8.8.8.Rules to determine the static IP adres:
Source:
https://www.howtogeek.com/184310/ask-htg-should-i-be-setting-static-ip-addresses-on-my-router/3.1 Do not assign an address that ends in .0 or .255 as these addresses are typically reserved for network protocols.
3.2 Do not assign an address to the very start of the IP pool, e.g. 10.0.0.1 as the start address is always reserved for the router. Even if you’ve changed the IP address of your router for security purposes, we’d still suggest against assigning a computer.
3.3 Do not assign an address outside of the total available pool of private IP addresses. This means if your router’s pool is 10.0.0.0 through 10.255.255.255 every IP you assign (keeping in mind the prior two rules) should fall within that range.
This is the (semi) automated equivalent of manually filling in the data of the first figure of this post, in order to set a static IP.
(Wifi connection issues troubleshoot) If:
- you have 2 different wifi networks (
AandB) to which you can both connect at the same location - where only
Bhas the right"your_routers_ip_adress"/local gateway-adress - And you accidentally set your
local IPto (the wrong)static IPwhilst connect to the wrong wifi (A), - Then disconnected the wrong wifi (
A) before setting thelocal IPadress to dynamic again, and (as a consequence) experience wifi troubles: (keeps
scanning network requirements).Then either:
set the
local IPadress todynamic.- Reconnect to the wrong wifi network (
A). - Set it back to
static, and todynamicagain. - Disconnect from wifi (
A). Now you should be able to connect to both wifi networks correct again.
Or:
set the
local IPadress tostatic.- Reconnect to the wrong wifi network (
A). - Set it back to
static, and todynamicagain. - Disconnect from wifi (
A). - Now you should be able to connect to both wifi networks correct again.
- you have 2 different wifi networks (
add a comment |
Please note that this is the implementation of: http://www.midnightdba.com/Jen/2014/03/configure-static-or-dynamic-ip-and-dns-with-powershell/. All credits go to MidnightDBA. I hope it benefits someone!
To set the IP adress to static manually
Start>control panel>Network and Internet>Network and Sharing Center>Change adapter settings>rmb on the ethernet/wifi/connection that is in use>properties>Select: Internet Protocol Version 4(TCP/IPv4)>Properties>That should result in the screen similar to the attached image. There you can fill in the numbers manually. These numbers will (probably) be different in your own situation, you need to do the work suggested in note 3. to determine those numbers for yourself.

To set the static IP (semi-automatically):
This means you will be able to to set the IP address to static by opening a file (double clicking a script you've made), and back to a dynamic IP address by running another script you've made. The instruction steps are listed below:
start>type Powershell>rmb>Open powershell as administrator- (Only do this step if you can not immediately run the script the first time.) Type:
Set-ExecutionPolicy RemoteSigned -Scope CurrentUserand hit enter, to set the security policy so that you can run a powershell script. create a
.ps1file named e.g.static_ip.ps1in for examplec:/example_folderwith the content:$wmi = Get-WmiObject win32_networkadapterconfiguration -filter "ipenabled ='true'";
$wmi.EnableStatic("your_static_ip_adress", "your_subnetmask");
$wmi.SetGateways("your_routers_ip_adress", 1);
$wmi.SetDNSServerSearchOrder("your_dns");OR to set the static IP with just a single double click on the
static_ip.ps1script:
(Note example values filled in)# 18-07-20 Todo: add wifi network detection that automatically triggers setting a static IP and back dynamic IP.
# First ensure the script is automatically ran as administrator, else it appearently does not have the privileges to change the local IP adress:
$currentUser = New-Object Security.Principal.WindowsPrincipal $([Security.Principal.WindowsIdentity]::GetCurrent())
$testadmin = $currentUser.IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator)
if ($testadmin -eq $false)
Start-Process powershell.exe -Verb RunAs -ArgumentList ('-noprofile -noexit -file "0" -elevated' -f ($myinvocation.MyCommand.Definition))
exit $LASTEXITCODE
# Next set it static:
$wmi.EnableStatic("192.21.89.5", "255.255.254.0");
$wmi.SetGateways("192.21.89.1", 1);
$wmi.SetDNSServerSearchOrder("192.21.89.1");
# Now close the window this has just created.
# This leaves other Powershell windows open if they were already open before you ran this script.
# Also, It yields an error with a $ sign at the start of the line.
# Source: https://stackoverflow.com/questions/14874619/powershell-exit-doesnt-really-exit
Stop-Process -Id $PIDThen in powershell enter:
cd c:/example_folder
.static_ip.ps1Note, if the path to the
static_ip.ps1file contains a space change thechange directory-command to:cd "c:/example_folder"
To make the IP dynamic again (semi-automatically):
Create a text file named for example
dynamic_ip.ps1located e.g. in folderc:/examplefolderwith content:$wmi = Get-WmiObject win32_networkadapterconfiguration -filter "ipenabled ='true'";
$wmi.EnableDHCP();
$wmi.SetDNSServerSearchOrder();OR to just change it with a single double-click on the
dynamic_ip.ps1script:#18-07-20 Todo: add wifi network detection that automatically triggers setting a static IP and back dynamic IP.
# First ensure the script is automatically ran as administrator, else it appearently does not have the privileges to change the local IP adress:
$currentUser = New-Object Security.Principal.WindowsPrincipal $([Security.Principal.WindowsIdentity]::GetCurrent())
$testadmin = $currentUser.IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator)
if ($testadmin -eq $false)
Start-Process powershell.exe -Verb RunAs -ArgumentList ('-noprofile -noexit -file "0" -elevated' -f ($myinvocation.MyCommand.Definition))
exit $LASTEXITCODE
# Next set it dynamic:
$wmi = Get-WmiObject win32_networkadapterconfiguration -filter "ipenabled ='true'";
$wmi.EnableDHCP();
$wmi.SetDNSServerSearchOrder();
# Now close the window this has just created.
# This leaves other Powershell windows open if they were already open before you ran this script.
# Also, It yields an error with a $ sign at the start of the line.
# Source: https://stackoverflow.com/questions/14874619/powershell-exit-doesnt-really-exit
Stop-Process -Id $PIDIn powershell:
cd c:/example_folder
.dynamic_ip.ps1
After you have tried it out the first time in powershell succesfully, you can simply set a static IP adress by opening/running the script by opening it with powershell (In explorer, double click the file, or right mouse button (rmb)>open with powershell). But for this to work, the path to the scripts cannot contain any spaces!
Additional notes:
Do not forget to make the IP adress dynamic again if you leave your home network again, otherwise you can get a problem when you try to access the internet in other wifi/ethernet networks!
your_static_ip_adress: you can read your dynamic ip adress and routers ip adress by:start>type cmd>open command prompt>type: ipconfig, or type:ipconfig -all.* Furthermore, the rules described in the note above, generally apply.your_routers_ip_adresssee "your_static_ip_adress", usually ends with a.1your_subnetmasksee "your_static_ip_adress"your_dns, this can be your routers ip adress, or for example googles DNS8.8.8.8.Rules to determine the static IP adres:
Source:
https://www.howtogeek.com/184310/ask-htg-should-i-be-setting-static-ip-addresses-on-my-router/3.1 Do not assign an address that ends in .0 or .255 as these addresses are typically reserved for network protocols.
3.2 Do not assign an address to the very start of the IP pool, e.g. 10.0.0.1 as the start address is always reserved for the router. Even if you’ve changed the IP address of your router for security purposes, we’d still suggest against assigning a computer.
3.3 Do not assign an address outside of the total available pool of private IP addresses. This means if your router’s pool is 10.0.0.0 through 10.255.255.255 every IP you assign (keeping in mind the prior two rules) should fall within that range.
This is the (semi) automated equivalent of manually filling in the data of the first figure of this post, in order to set a static IP.
(Wifi connection issues troubleshoot) If:
- you have 2 different wifi networks (
AandB) to which you can both connect at the same location - where only
Bhas the right"your_routers_ip_adress"/local gateway-adress - And you accidentally set your
local IPto (the wrong)static IPwhilst connect to the wrong wifi (A), - Then disconnected the wrong wifi (
A) before setting thelocal IPadress to dynamic again, and (as a consequence) experience wifi troubles: (keeps
scanning network requirements).Then either:
set the
local IPadress todynamic.- Reconnect to the wrong wifi network (
A). - Set it back to
static, and todynamicagain. - Disconnect from wifi (
A). Now you should be able to connect to both wifi networks correct again.
Or:
set the
local IPadress tostatic.- Reconnect to the wrong wifi network (
A). - Set it back to
static, and todynamicagain. - Disconnect from wifi (
A). - Now you should be able to connect to both wifi networks correct again.
- you have 2 different wifi networks (
Please note that this is the implementation of: http://www.midnightdba.com/Jen/2014/03/configure-static-or-dynamic-ip-and-dns-with-powershell/. All credits go to MidnightDBA. I hope it benefits someone!
To set the IP adress to static manually
Start>control panel>Network and Internet>Network and Sharing Center>Change adapter settings>rmb on the ethernet/wifi/connection that is in use>properties>Select: Internet Protocol Version 4(TCP/IPv4)>Properties>That should result in the screen similar to the attached image. There you can fill in the numbers manually. These numbers will (probably) be different in your own situation, you need to do the work suggested in note 3. to determine those numbers for yourself.

To set the static IP (semi-automatically):
This means you will be able to to set the IP address to static by opening a file (double clicking a script you've made), and back to a dynamic IP address by running another script you've made. The instruction steps are listed below:
start>type Powershell>rmb>Open powershell as administrator- (Only do this step if you can not immediately run the script the first time.) Type:
Set-ExecutionPolicy RemoteSigned -Scope CurrentUserand hit enter, to set the security policy so that you can run a powershell script. create a
.ps1file named e.g.static_ip.ps1in for examplec:/example_folderwith the content:$wmi = Get-WmiObject win32_networkadapterconfiguration -filter "ipenabled ='true'";
$wmi.EnableStatic("your_static_ip_adress", "your_subnetmask");
$wmi.SetGateways("your_routers_ip_adress", 1);
$wmi.SetDNSServerSearchOrder("your_dns");OR to set the static IP with just a single double click on the
static_ip.ps1script:
(Note example values filled in)# 18-07-20 Todo: add wifi network detection that automatically triggers setting a static IP and back dynamic IP.
# First ensure the script is automatically ran as administrator, else it appearently does not have the privileges to change the local IP adress:
$currentUser = New-Object Security.Principal.WindowsPrincipal $([Security.Principal.WindowsIdentity]::GetCurrent())
$testadmin = $currentUser.IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator)
if ($testadmin -eq $false)
Start-Process powershell.exe -Verb RunAs -ArgumentList ('-noprofile -noexit -file "0" -elevated' -f ($myinvocation.MyCommand.Definition))
exit $LASTEXITCODE
# Next set it static:
$wmi.EnableStatic("192.21.89.5", "255.255.254.0");
$wmi.SetGateways("192.21.89.1", 1);
$wmi.SetDNSServerSearchOrder("192.21.89.1");
# Now close the window this has just created.
# This leaves other Powershell windows open if they were already open before you ran this script.
# Also, It yields an error with a $ sign at the start of the line.
# Source: https://stackoverflow.com/questions/14874619/powershell-exit-doesnt-really-exit
Stop-Process -Id $PIDThen in powershell enter:
cd c:/example_folder
.static_ip.ps1Note, if the path to the
static_ip.ps1file contains a space change thechange directory-command to:cd "c:/example_folder"
To make the IP dynamic again (semi-automatically):
Create a text file named for example
dynamic_ip.ps1located e.g. in folderc:/examplefolderwith content:$wmi = Get-WmiObject win32_networkadapterconfiguration -filter "ipenabled ='true'";
$wmi.EnableDHCP();
$wmi.SetDNSServerSearchOrder();OR to just change it with a single double-click on the
dynamic_ip.ps1script:#18-07-20 Todo: add wifi network detection that automatically triggers setting a static IP and back dynamic IP.
# First ensure the script is automatically ran as administrator, else it appearently does not have the privileges to change the local IP adress:
$currentUser = New-Object Security.Principal.WindowsPrincipal $([Security.Principal.WindowsIdentity]::GetCurrent())
$testadmin = $currentUser.IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator)
if ($testadmin -eq $false)
Start-Process powershell.exe -Verb RunAs -ArgumentList ('-noprofile -noexit -file "0" -elevated' -f ($myinvocation.MyCommand.Definition))
exit $LASTEXITCODE
# Next set it dynamic:
$wmi = Get-WmiObject win32_networkadapterconfiguration -filter "ipenabled ='true'";
$wmi.EnableDHCP();
$wmi.SetDNSServerSearchOrder();
# Now close the window this has just created.
# This leaves other Powershell windows open if they were already open before you ran this script.
# Also, It yields an error with a $ sign at the start of the line.
# Source: https://stackoverflow.com/questions/14874619/powershell-exit-doesnt-really-exit
Stop-Process -Id $PIDIn powershell:
cd c:/example_folder
.dynamic_ip.ps1
After you have tried it out the first time in powershell succesfully, you can simply set a static IP adress by opening/running the script by opening it with powershell (In explorer, double click the file, or right mouse button (rmb)>open with powershell). But for this to work, the path to the scripts cannot contain any spaces!
Additional notes:
Do not forget to make the IP adress dynamic again if you leave your home network again, otherwise you can get a problem when you try to access the internet in other wifi/ethernet networks!
your_static_ip_adress: you can read your dynamic ip adress and routers ip adress by:start>type cmd>open command prompt>type: ipconfig, or type:ipconfig -all.* Furthermore, the rules described in the note above, generally apply.your_routers_ip_adresssee "your_static_ip_adress", usually ends with a.1your_subnetmasksee "your_static_ip_adress"your_dns, this can be your routers ip adress, or for example googles DNS8.8.8.8.Rules to determine the static IP adres:
Source:
https://www.howtogeek.com/184310/ask-htg-should-i-be-setting-static-ip-addresses-on-my-router/3.1 Do not assign an address that ends in .0 or .255 as these addresses are typically reserved for network protocols.
3.2 Do not assign an address to the very start of the IP pool, e.g. 10.0.0.1 as the start address is always reserved for the router. Even if you’ve changed the IP address of your router for security purposes, we’d still suggest against assigning a computer.
3.3 Do not assign an address outside of the total available pool of private IP addresses. This means if your router’s pool is 10.0.0.0 through 10.255.255.255 every IP you assign (keeping in mind the prior two rules) should fall within that range.
This is the (semi) automated equivalent of manually filling in the data of the first figure of this post, in order to set a static IP.
(Wifi connection issues troubleshoot) If:
- you have 2 different wifi networks (
AandB) to which you can both connect at the same location - where only
Bhas the right"your_routers_ip_adress"/local gateway-adress - And you accidentally set your
local IPto (the wrong)static IPwhilst connect to the wrong wifi (A), - Then disconnected the wrong wifi (
A) before setting thelocal IPadress to dynamic again, and (as a consequence) experience wifi troubles: (keeps
scanning network requirements).Then either:
set the
local IPadress todynamic.- Reconnect to the wrong wifi network (
A). - Set it back to
static, and todynamicagain. - Disconnect from wifi (
A). Now you should be able to connect to both wifi networks correct again.
Or:
set the
local IPadress tostatic.- Reconnect to the wrong wifi network (
A). - Set it back to
static, and todynamicagain. - Disconnect from wifi (
A). - Now you should be able to connect to both wifi networks correct again.
- you have 2 different wifi networks (
edited Aug 3 '18 at 19:20
answered Jul 10 '18 at 19:46
a.t.a.t.
398316
398316
add a comment |
add a comment |
Nice information with GUI and PowerShell.
When you assign the IP manually by the PowerShell, the DNS server IP is important. Also, it can be done via the command prompt which is useful while managing the PCs remotely. The below post has the information. Maybe you can consider adding those steps in your post.
https://tinylaptop.net/how-to-configure-setup-static-ip-on-windows-10-laptop/
2
While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes.
– Rotemya
Mar 23 at 8:25
add a comment |
Nice information with GUI and PowerShell.
When you assign the IP manually by the PowerShell, the DNS server IP is important. Also, it can be done via the command prompt which is useful while managing the PCs remotely. The below post has the information. Maybe you can consider adding those steps in your post.
https://tinylaptop.net/how-to-configure-setup-static-ip-on-windows-10-laptop/
2
While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes.
– Rotemya
Mar 23 at 8:25
add a comment |
Nice information with GUI and PowerShell.
When you assign the IP manually by the PowerShell, the DNS server IP is important. Also, it can be done via the command prompt which is useful while managing the PCs remotely. The below post has the information. Maybe you can consider adding those steps in your post.
https://tinylaptop.net/how-to-configure-setup-static-ip-on-windows-10-laptop/
Nice information with GUI and PowerShell.
When you assign the IP manually by the PowerShell, the DNS server IP is important. Also, it can be done via the command prompt which is useful while managing the PCs remotely. The below post has the information. Maybe you can consider adding those steps in your post.
https://tinylaptop.net/how-to-configure-setup-static-ip-on-windows-10-laptop/
answered Mar 23 at 8:18
DineshDinesh
1
1
2
While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes.
– Rotemya
Mar 23 at 8:25
add a comment |
2
While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes.
– Rotemya
Mar 23 at 8:25
2
2
While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes.
– Rotemya
Mar 23 at 8:25
While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes.
– Rotemya
Mar 23 at 8:25
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f51272961%2fhow-to-set-a-static-ip-address-in-windows-10%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
@Bill_Stewart The question is how to set a static IP in Windows 10, but it's terribly stated. This is a Q&A question.
– TheIncorrigible1
Jul 10 '18 at 19:57
1
Please restate the question as an actual question. Here's an example where I posed a question I already knew the answer to, and then answered it.
– Bender the Greatest
Jul 10 '18 at 21:32
Thank you for your comments, the question was indeed not formulated properly. I have adapted the question to include the complete and explicit question in the body of the "question-text" of this post. I appreciate the example of an implementation of your suggestion @BendertheGreatest.
– a.t.
Jul 11 '18 at 8:36