{"id":76950,"date":"2023-08-18T13:43:35","date_gmt":"2023-08-18T11:43:35","guid":{"rendered":"https:\/\/jotelulu.com\/en-gb\/blog\/"},"modified":"2025-12-12T15:13:51","modified_gmt":"2025-12-12T14:13:51","slug":"configure-network-powershell","status":"publish","type":"post","link":"https:\/\/jotelulu.com\/en-gb\/blog\/configure-network-powershell\/","title":{"rendered":"How to configure network data using a PowerShell script"},"content":{"rendered":"<p>Check out this article to learn <strong>how to configure network settings using a PowerShell script<\/strong>\u2014a much faster way to set up both client machines and servers.<\/p>\n<p>This approach simplifies deploying multiple systems autonomously. This is a basic version that can be expanded for even more automated network configurations.<\/p>\n<h2><strong>How to configure network settings using PowerShell?<\/strong><\/h2>\n<p>Always test commands individually on a test server or client first to understand exactly what they do\u2014even when using proven scripts from trusted sources.<\/p>\n<p>This script configures two main elements:<\/p>\n<ul>\n<li><strong>Static IP configuration<\/strong> including:\n<ul>\n<li>IP address<\/li>\n<li>Network prefix<\/li>\n<li>Default gateway<\/li>\n<li>DNS server<\/li>\n<\/ul>\n<\/li>\n<li><strong>Computer name change<\/strong><\/li>\n<\/ul>\n<p>Before running the script, determine your network values and replace these example values:<\/p>\n<pre><code>&lt;IP Address&gt; = 192.168.1.101\r\n&lt;Network Prefix&gt; = 24\r\n&lt;Default Gateway&gt; = 192.168.1.1<\/code><\/pre>\n<p>The basic IP command becomes:<\/p>\n<pre><code>New-NetIPAddress -IPAddress 192.168.1.101 -PrefixLength 24 -DefaultGateway 192.168.1.1<\/code><\/pre>\n<p>For reusability, convert these into variables:<\/p>\n<pre><code>$direccionip = \"192.168.1.101\"\r\n$prefijodered = \"24\"\r\n$puertadeenlacegw = \"192.168.1.1\"\r\n$interfaz = (Get-NetAdapter).ifIndex\r\nNew-NetIPAddress -IPAddress $direccionip -PrefixLength $prefijodered -InterfaceIndex $interfaz -DefaultGateway $puertadeenlacegw<\/code><\/pre>\n<p>Create a <code>.ps1<\/code> file named <code>configuracionred.ps1<\/code> with your script.<\/p>\n<p>To also change the computer name (recommended for organized infrastructure), add:<\/p>\n<pre><code>$nombre = \"PC-Nacho\"\r\nRename-Computer -NewName $nombre -Force<\/code><\/pre>\n<p>The complete unified script looks like this:<\/p>\n<pre><code>$direccionip = \"192.168.1.101\"\r\n$prefijodered = \"24\"\r\n$puertadeenlacegw = \"192.168.1.1\"\r\n$nombre = \"PC-Nacho\"\r\n$interfaz = (Get-NetAdapter).ifIndex\r\nNew-NetIPAddress -IPAddress $direccionip -PrefixLength $prefijodered -InterfaceIndex $interfaz -DefaultGateway $puertadeenlacegw\r\nRename-Computer -NewName $nombre -Force<\/code><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-20426\" src=\"https:\/\/jotelulu.com\/wp-content\/uploads\/2023\/08\/Imagen.-Vista-completa-del-script-de-asignacion-de-datos-de-red-y-nombre-mediante-script-de-PowerShell-1.jpg\" alt=\"Complete PowerShell script for network settings and computer name configuration\" width=\"1937\" height=\"1037\" \/><\/p>\n<h2><strong>Conclusions and Next Steps<\/strong><\/h2>\n<p>This article demonstrates <strong>how to configure network settings using a PowerShell script<\/strong>, automating common network tasks with simple PowerShell commands.<\/p>\n<p>After running the script, you&#8217;ll have configured:<\/p>\n<ul>\n<li>IP address<\/li>\n<li>Network prefix<\/li>\n<li>Default gateway<\/li>\n<li>DNS server<\/li>\n<li>Computer name<\/li>\n<\/ul>\n<p>The entire process takes just a few steps. Learn more PowerShell automation techniques on our <a href=\"https:\/\/jotelulu.com\/en-gb\/blog\/\" target=\"_blank\" rel=\"noopener\">blog<\/a>.<\/p>\n<p>If you run into any issues, don&#8217;t hesitate to contact us\u2014we&#8217;re here to help troubleshoot.<\/p>\n<p><strong>Thank you for your trust!<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Check out this article to learn how to configure network settings using a PowerShell script\u2014a much faster way to set up both client machines and servers. This approach simplifies deploying multiple systems autonomously. This is a basic version that can be expanded for even more automated network configurations. How to configure network settings using PowerShell? [&hellip;]<\/p>\n","protected":false},"author":6,"featured_media":76953,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[278],"tags":[],"class_list":["post-76950","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cloud-and-systems"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to configure network data using a PowerShell script - Jotelulu<\/title>\n<meta name=\"description\" content=\"Learn how to automate network configuration using PowerShell. Set static IP addresses, gateways, DNS, and computer names with a single script. Perfect for server and client deployments.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/jotelulu.com\/en-gb\/blog\/configure-network-powershell\/\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to configure network data using a PowerShell script - Jotelulu\" \/>\n<meta property=\"og:description\" content=\"Learn how to automate network configuration using PowerShell. Set static IP addresses, gateways, DNS, and computer names with a single script. Perfect for server and client deployments.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jotelulu.com\/en-gb\/blog\/configure-network-powershell\/\" \/>\n<meta property=\"og:site_name\" content=\"Jotelulu\" \/>\n<meta property=\"article:published_time\" content=\"2023-08-18T11:43:35+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-12-12T14:13:51+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/jotelulu.com\/wp-content\/uploads\/2025\/12\/Configurar-datos-red-script-powershell-scaled-2.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"2560\" \/>\n\t<meta property=\"og:image:height\" content=\"1549\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Juan Ignacio Oller Aznar\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Juan Ignacio Oller Aznar\" \/>\n\t<meta name=\"twitter:label2\" content=\"Estimated reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/jotelulu.com\\\/en-gb\\\/blog\\\/configure-network-powershell\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jotelulu.com\\\/en-gb\\\/blog\\\/configure-network-powershell\\\/\"},\"author\":{\"name\":\"Juan Ignacio Oller Aznar\",\"@id\":\"https:\\\/\\\/jotelulu.com\\\/en-gb\\\/#\\\/schema\\\/person\\\/2ae97818cae086c48f108cd74234aca9\"},\"headline\":\"How to configure network data using a PowerShell script\",\"datePublished\":\"2023-08-18T11:43:35+00:00\",\"dateModified\":\"2025-12-12T14:13:51+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/jotelulu.com\\\/en-gb\\\/blog\\\/configure-network-powershell\\\/\"},\"wordCount\":241,\"image\":{\"@id\":\"https:\\\/\\\/jotelulu.com\\\/en-gb\\\/blog\\\/configure-network-powershell\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/jotelulu.com\\\/wp-content\\\/uploads\\\/2025\\\/12\\\/Configurar-datos-red-script-powershell-scaled-2.jpg\",\"articleSection\":[\"Cloud and Systems\"],\"inLanguage\":\"en-GB\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/jotelulu.com\\\/en-gb\\\/blog\\\/configure-network-powershell\\\/\",\"url\":\"https:\\\/\\\/jotelulu.com\\\/en-gb\\\/blog\\\/configure-network-powershell\\\/\",\"name\":\"How to configure network data using a PowerShell script - Jotelulu\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jotelulu.com\\\/en-gb\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/jotelulu.com\\\/en-gb\\\/blog\\\/configure-network-powershell\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/jotelulu.com\\\/en-gb\\\/blog\\\/configure-network-powershell\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/jotelulu.com\\\/wp-content\\\/uploads\\\/2025\\\/12\\\/Configurar-datos-red-script-powershell-scaled-2.jpg\",\"datePublished\":\"2023-08-18T11:43:35+00:00\",\"dateModified\":\"2025-12-12T14:13:51+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/jotelulu.com\\\/en-gb\\\/#\\\/schema\\\/person\\\/2ae97818cae086c48f108cd74234aca9\"},\"description\":\"Learn how to automate network configuration using PowerShell. Set static IP addresses, gateways, DNS, and computer names with a single script. Perfect for server and client deployments.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/jotelulu.com\\\/en-gb\\\/blog\\\/configure-network-powershell\\\/#breadcrumb\"},\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/jotelulu.com\\\/en-gb\\\/blog\\\/configure-network-powershell\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\\\/\\\/jotelulu.com\\\/en-gb\\\/blog\\\/configure-network-powershell\\\/#primaryimage\",\"url\":\"https:\\\/\\\/jotelulu.com\\\/wp-content\\\/uploads\\\/2025\\\/12\\\/Configurar-datos-red-script-powershell-scaled-2.jpg\",\"contentUrl\":\"https:\\\/\\\/jotelulu.com\\\/wp-content\\\/uploads\\\/2025\\\/12\\\/Configurar-datos-red-script-powershell-scaled-2.jpg\",\"width\":2560,\"height\":1549},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/jotelulu.com\\\/en-gb\\\/blog\\\/configure-network-powershell\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Portada\",\"item\":\"https:\\\/\\\/jotelulu.com\\\/en-gb\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to configure network data using a PowerShell script\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/jotelulu.com\\\/en-gb\\\/#website\",\"url\":\"https:\\\/\\\/jotelulu.com\\\/en-gb\\\/\",\"name\":\"Jotelulu\",\"description\":\"Cloud Paradise for Tech Companies\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/jotelulu.com\\\/en-gb\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-GB\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/jotelulu.com\\\/en-gb\\\/#\\\/schema\\\/person\\\/2ae97818cae086c48f108cd74234aca9\",\"name\":\"Juan Ignacio Oller Aznar\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/87efd80399b2c40a1d78dd5cee4e788d3f6c29d33e3b67bcfbc6abbf91d0fdcf?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/87efd80399b2c40a1d78dd5cee4e788d3f6c29d33e3b67bcfbc6abbf91d0fdcf?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/87efd80399b2c40a1d78dd5cee4e788d3f6c29d33e3b67bcfbc6abbf91d0fdcf?s=96&d=mm&r=g\",\"caption\":\"Juan Ignacio Oller Aznar\"},\"url\":\"https:\\\/\\\/jotelulu.com\\\/en-gb\\\/author\\\/juanignaciooller\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to configure network data using a PowerShell script - Jotelulu","description":"Learn how to automate network configuration using PowerShell. Set static IP addresses, gateways, DNS, and computer names with a single script. Perfect for server and client deployments.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/jotelulu.com\/en-gb\/blog\/configure-network-powershell\/","og_locale":"en_GB","og_type":"article","og_title":"How to configure network data using a PowerShell script - Jotelulu","og_description":"Learn how to automate network configuration using PowerShell. Set static IP addresses, gateways, DNS, and computer names with a single script. Perfect for server and client deployments.","og_url":"https:\/\/jotelulu.com\/en-gb\/blog\/configure-network-powershell\/","og_site_name":"Jotelulu","article_published_time":"2023-08-18T11:43:35+00:00","article_modified_time":"2025-12-12T14:13:51+00:00","og_image":[{"width":2560,"height":1549,"url":"https:\/\/jotelulu.com\/wp-content\/uploads\/2025\/12\/Configurar-datos-red-script-powershell-scaled-2.jpg","type":"image\/jpeg"}],"author":"Juan Ignacio Oller Aznar","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Juan Ignacio Oller Aznar","Estimated reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/jotelulu.com\/en-gb\/blog\/configure-network-powershell\/#article","isPartOf":{"@id":"https:\/\/jotelulu.com\/en-gb\/blog\/configure-network-powershell\/"},"author":{"name":"Juan Ignacio Oller Aznar","@id":"https:\/\/jotelulu.com\/en-gb\/#\/schema\/person\/2ae97818cae086c48f108cd74234aca9"},"headline":"How to configure network data using a PowerShell script","datePublished":"2023-08-18T11:43:35+00:00","dateModified":"2025-12-12T14:13:51+00:00","mainEntityOfPage":{"@id":"https:\/\/jotelulu.com\/en-gb\/blog\/configure-network-powershell\/"},"wordCount":241,"image":{"@id":"https:\/\/jotelulu.com\/en-gb\/blog\/configure-network-powershell\/#primaryimage"},"thumbnailUrl":"https:\/\/jotelulu.com\/wp-content\/uploads\/2025\/12\/Configurar-datos-red-script-powershell-scaled-2.jpg","articleSection":["Cloud and Systems"],"inLanguage":"en-GB"},{"@type":"WebPage","@id":"https:\/\/jotelulu.com\/en-gb\/blog\/configure-network-powershell\/","url":"https:\/\/jotelulu.com\/en-gb\/blog\/configure-network-powershell\/","name":"How to configure network data using a PowerShell script - Jotelulu","isPartOf":{"@id":"https:\/\/jotelulu.com\/en-gb\/#website"},"primaryImageOfPage":{"@id":"https:\/\/jotelulu.com\/en-gb\/blog\/configure-network-powershell\/#primaryimage"},"image":{"@id":"https:\/\/jotelulu.com\/en-gb\/blog\/configure-network-powershell\/#primaryimage"},"thumbnailUrl":"https:\/\/jotelulu.com\/wp-content\/uploads\/2025\/12\/Configurar-datos-red-script-powershell-scaled-2.jpg","datePublished":"2023-08-18T11:43:35+00:00","dateModified":"2025-12-12T14:13:51+00:00","author":{"@id":"https:\/\/jotelulu.com\/en-gb\/#\/schema\/person\/2ae97818cae086c48f108cd74234aca9"},"description":"Learn how to automate network configuration using PowerShell. Set static IP addresses, gateways, DNS, and computer names with a single script. Perfect for server and client deployments.","breadcrumb":{"@id":"https:\/\/jotelulu.com\/en-gb\/blog\/configure-network-powershell\/#breadcrumb"},"inLanguage":"en-GB","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jotelulu.com\/en-gb\/blog\/configure-network-powershell\/"]}]},{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/jotelulu.com\/en-gb\/blog\/configure-network-powershell\/#primaryimage","url":"https:\/\/jotelulu.com\/wp-content\/uploads\/2025\/12\/Configurar-datos-red-script-powershell-scaled-2.jpg","contentUrl":"https:\/\/jotelulu.com\/wp-content\/uploads\/2025\/12\/Configurar-datos-red-script-powershell-scaled-2.jpg","width":2560,"height":1549},{"@type":"BreadcrumbList","@id":"https:\/\/jotelulu.com\/en-gb\/blog\/configure-network-powershell\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Portada","item":"https:\/\/jotelulu.com\/en-gb\/"},{"@type":"ListItem","position":2,"name":"How to configure network data using a PowerShell script"}]},{"@type":"WebSite","@id":"https:\/\/jotelulu.com\/en-gb\/#website","url":"https:\/\/jotelulu.com\/en-gb\/","name":"Jotelulu","description":"Cloud Paradise for Tech Companies","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/jotelulu.com\/en-gb\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-GB"},{"@type":"Person","@id":"https:\/\/jotelulu.com\/en-gb\/#\/schema\/person\/2ae97818cae086c48f108cd74234aca9","name":"Juan Ignacio Oller Aznar","image":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/secure.gravatar.com\/avatar\/87efd80399b2c40a1d78dd5cee4e788d3f6c29d33e3b67bcfbc6abbf91d0fdcf?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/87efd80399b2c40a1d78dd5cee4e788d3f6c29d33e3b67bcfbc6abbf91d0fdcf?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/87efd80399b2c40a1d78dd5cee4e788d3f6c29d33e3b67bcfbc6abbf91d0fdcf?s=96&d=mm&r=g","caption":"Juan Ignacio Oller Aznar"},"url":"https:\/\/jotelulu.com\/en-gb\/author\/juanignaciooller\/"}]}},"_links":{"self":[{"href":"https:\/\/jotelulu.com\/en-gb\/wp-json\/wp\/v2\/posts\/76950","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jotelulu.com\/en-gb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jotelulu.com\/en-gb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jotelulu.com\/en-gb\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/jotelulu.com\/en-gb\/wp-json\/wp\/v2\/comments?post=76950"}],"version-history":[{"count":3,"href":"https:\/\/jotelulu.com\/en-gb\/wp-json\/wp\/v2\/posts\/76950\/revisions"}],"predecessor-version":[{"id":77049,"href":"https:\/\/jotelulu.com\/en-gb\/wp-json\/wp\/v2\/posts\/76950\/revisions\/77049"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/jotelulu.com\/en-gb\/wp-json\/wp\/v2\/media\/76953"}],"wp:attachment":[{"href":"https:\/\/jotelulu.com\/en-gb\/wp-json\/wp\/v2\/media?parent=76950"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jotelulu.com\/en-gb\/wp-json\/wp\/v2\/categories?post=76950"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jotelulu.com\/en-gb\/wp-json\/wp\/v2\/tags?post=76950"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}