$Name is not reachable but still trying to connect.", 'Type Your credentials to connect remotely', " Connected to $Name successfully but no NIC found with name $NetworkName", " DNS IP on $Name did not changed, check manually. Welcome to another SpiceQuest! 3. set-DnsClientServerAddress -InterfaceIndex 9 -ServerAddresses ("8.8.8.8","1.1.1.1") The Set-DnsClientServerAddress sets the DNS server addresses on an interface . So it works on all these Windows OS flavours, contrary to what the Release Notes seem to say. PowerShell: Automatic Join-Domain with Secure String - 'Encryption Key' Usage, Copying a file from a shared folder to a remote machine using PowerShell, Setting static ip via powershell doesn't work, PowerShell Script Has Wrong Icon and Context Menu Items. In Alan's blog post, called PowerCLI: Changing a VM IP Address with Invoke-VMScript, you find a sample implementation of this. Any other messages are welcome. Learn PowerShell with our PowerShell guides! What I want to do is to get all InterfaceAlias Ethernet 2 (and nothing else) and then use its corresponding InterfaceIndex, which should also have one value only. Why do we kill some animals but not others? You can also disable DNS registration for the NIC. Use this parameter to run commands that take a long time to complete. Changing an IP Address can be done using the New-NetIPAddress cmdlet, it has a lot of parameters, some of which, are not even documented in Get-Help. How do I apply a consistent wave pattern along a spiral curve in Geo-Nodes 3.3? The PrefixLength parameter may also be specified as part of the Set-NetIPAddress cmdlet. He served as Microsoft Regional Director in South Africa for two years and has received multiple Microsoft MVP (Most Valued Professional) awards. You could do something like $info = Invoke-Command -ComputerName Dc01,FS03 -ScriptBlock {Get-NetAdapter}. Stack Exchange network consists of 181 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers. This sets DNS Ip addresses, multiple DNS servers can be provided with this parameters. You will first use a query to obtain the correct WMI object that allows you to tweak IP settings. Does Cast a Spell make you a spellcaster? If it isn't the script retrieves the log of the scheduled . Hi, Joe. Paste the code from this post in the psm1 file, and save it. -Credential = This is another optional parameter and here you can add credentials to connect remotely or locally. Im glad you find this useful. Hi, Sal. Once the user types in 192.168.x.x, it will update the IPv4 settings with the static IP the user had input, plus the pre-defined subnet mask . I learned all the languages I know because I was required to make something, this allowed me to learn on the job. Check the result and you'll see the new address assigned to the NIC. The second command then uses the TimeSpan object to set the preferred lifetime of the IP address located at interface 12 to one day. Purpose/Change: Update to my existing script buit on 1 June 2013 (http://kunaludapi.blogspot.in/2013/06/change-dns-ip-address-remotely-on.html), Useful URLs: http://vcloud-lab.com/entries/powershell/powershell-ps-remoting-between-standalone-workgroup-computers, PS C:\>Set-DNSIP -Name MyServer01 -NetworkName Ethernet -DnsIPs @('192.168.33.5', '192.168.33.6'). As it can be seen in below screenshot, There are 2 Nics In my environment, on all the server and I wanted to change DNS IPs onphysical adapter with nameEthernetonly. If you only want to disable DNS registration on certain Mac Addresses you already have, you could even ditch the function and do something like this: Set-DnsClient -InterfaceIndex $((Get-NetAdapter -CimSession ServerY | where MacAddress -Like AB-CD-EF*).ifIndex) -RegisterThisConnectionsAddress $false. -- Random. If youre new with PowerShell, getting comfortable with these concepts will be of great help. By submitting your email, you agree to the Terms of Use and Privacy Policy. . Of course, if you omitted this or mentioned that you wanted DNS registration, this step will not be performed. Or, you could work smart and use Windows Admin Center. Connect and share knowledge within a single location that is structured and easy to search. Not sure why. You can use PowerShell to run commands remotely on one or more computers in your network. AddToHosts.ps1. What does a search warrant actually look like? Since we launched in 2006, our articles have been read billions of times. The OS matters a lot as older / different versions of powershellneed different commands and ways if writing the code. If I can script this it can save at least an hour or more. Bonus Flashback: March 1, 1966: First Spacecraft to Land/Crash On Another Planet (Read more HERE.) An old post I know but for those Googling and hit this thread. PowerShell should be case insensitive (unless youre very specific about it, in some cases). But I am happy it actually works. :)) You could have also done Get-NetAdapter | where InterfaceAlias -like Ethernet 2 or whatever the NIC Alias was. Not much consolation now but worth bearing in mind in the future Afaik you just need to update the registry keys? You can use the Windows Management Instrumentation (WMI) to accomplish this. IP addresses are divided into two parts, the prefix and the suffix. How can I use Windows PowerShell to set the. -- DHCP. Deprecated. You'll also see how I went from a starting point to a fully working script - all thanks to the awesome #vCommunity! Learn more about Stack Overflow the company, and our products. To change your DNS Server you would use: Set-DnsClientServerAddress -InterfaceAlias Wired Ethernet Connection -ServerAddresses 192.168.0.1, 192.168.0.2. Youre right, YouTube videos will surely do a lot of help also. Besides just setting the IP address, if a system is statically addressed, one often needs to change the DNS servers that the interface uses to resolve IP addresses. Need a script to change multiple virtual machines PowerCLI: Changing a VM IP Address with Invoke-VMScript. as in example? -- PersistentStore. Consider a situation where you are asked to provide FQDN of multiple . As the function was working (I checked and tested it thoroughly), most likely the function's closing bracket was lost in the posting process. I think before you get into deeper stuff it would help you greatly to get more comfortable with the basic workings of PowerShell. Set-NetIPInterface. primary and secondary DNS server addresses for the client workstations? Microsoft Scripting Guy, Ed Wilson, is here. In the last if you have list of servers in plain text file replace Get-Adcomputer -filter * with cat filename.txt. You can indeed use the WHere-clause to select the actual NIC you need. . Get-DnsClientGlobalSetting. The printers themselves are deployed DHCP with reservations to ensure they keep the correct address (which has already been updated with the new VLAN). Yes, that is what we need to change. Do EMC test houses typically accept copper foil in EUT? Suspecting that the second value Ethernet is overwriting the 1st value Ethernet 2, Ive tested a code where the IF tries to catch Ethernet only. Open Command Prompt and type ipconfig /flushdns. $Nics = Get-Netadapter $Nics.InterfaceIndex, Get-NetAdapter | Select-Object -ExpandProperty InterfaceIndex, These approaches are applicable to pretty much all PowerShell commands, not really to this one in particular. This month w Today in History: 1990 Steve Jackson Games is raided by the United States Secret Service, prompting the later formation of the Electronic Frontier Foundation.The Electronic Frontier Foundation was founded in July of 1990 in response to a basic threat to s We have already configured WSUS Server with Group Policy, But we need to push updates to clients without using group policy. What if the value Ethernet 2 appears on the 2nd, 3rd, so on? Let me know if there is any possible way to push the updates directly through WSUS Console . 90% of my servers are 64 bit windows 2008. (Each task can be done at any time. Taylor Gibb is a professional software developer with nearly a decade of experience. How do I concatenate strings and variables in PowerShell? But how can i wrap this , so use the function under domain administrator creds? Ive made $InterfaceIndex4Set just so I can see whats inside it, after the movement of whatever is inside of InterfaceIndex. Planned Maintenance scheduled March 2nd, 2023 at 01:00 AM UTC (March 1st, How do version differences affect PowerShell commands on remote computers? Don't you hate it when you get to the office and discover you lost your house keys? I don't have access to change it (or I don't think I do), I'll point this to someone that definitely has. Thank you for the feedback, I am glad you found this useful. Could you give me an example of how to script the remove-printerport/add-printerport with a given CSV file? Great function, I'll gladly use this. That requires manual input of OldIP and NewIP and even when i did try the manual input of old/new IP, it didn't work. HEY DUDE? In my case, I called the file Set-IPStatic.ps1. The second is to use the objects directly using the CimCmdlets. Then, you will need to provide a new IP address. If the gateway is different from the former one, remove it, and set a . I recently changed the IP address scheme for an entire subnet. Setting Windows PowerShell environment variables, PowerShell says "execution of scripts is disabled on this system.". You can also subscribe without commenting. Specify ActiveStore only. I'm not a programmer by any standards but I know learning PS will enhance my ability to do my job so I need to learn it. He served as Microsoft Regional Director in South Africa for two years and has received multiple Microsoft MVP (Most Valued Professional) awards. Well, if you have more than one NIC, then you have an array. The part with the DNS server that I have to specify for the VM is the tricky part for me. Odd, seems like the upper case F in $False (line 114), causes problems in my shell. The acceptable values for this parameter are: -- Manual. This cmdlet uses CIM and WMI (DCom and winrm) protocol to connect remote computer. Changing an IP Address can be done using the New-NetIPAddress cmdlet, it has a lot of parameters, some of which, are not even documented in Get-Help. Name it Get-NetIPServerInfo. The default is the current session on the local computer. Set-DnsClientServerAddress. Making statements based on opinion; back them up with references or personal experience. Ok, wellI got it working but it is "SLOW"! Good, finally! How do I capture the same row of data once I get the Ethernet 2 value of InterfaceAlias? Or something different? I only need the 1st value of 7 to appear once the IF statement gets satisfied with an InterfaceAlias value of Ethernet 2. It works fine is I run the same command locally. Let's look at the code and then we can go through some of the interesting details. Need a script to change multiple virtual machines ip address, # This script will re-ip Virtual Machines using the X86 version of PowerCLI, # This assumes that your CSV file has the following columns, $HostCred = $Host.UI.PromptForCredential("Please enter credentials", "Enter ESX host credentials for $ESXHost", "esxrootuser", ""), $GuestCred = $Host.UI.PromptForCredential("Please enter credentials", "Enter Guest credentials", "adminuser", ""), Foreach($row in (Import-Csv "C:\scripts\server_reip.csv" -UseCulture)){, Get-VM $row.VMname | Get-VMGuestNetworkInterface -HostCredential $HostCred -GuestCredential $GuestCred |, where-object {$_.Name -eq "Local Area Connection"} |, Set-VMGuestNetworkInterface -HostCredential $HostCred -GuestCredential $GuestCred -IPPolicy static -Gateway $row.Gateway -Netmask $row.Netmask -Ip $row.ipaddr. Yes. All the scripts provided on my blogs are comes without any warranty, The entire risk and impacts arising out of the use or performance of the sample scripts and documentation remains with you. Notify me of followup comments via e-mail. Flashback: March 1, 2008: Netscape Discontinued (Read more HERE.) The cmdlet is not run. However, using the 1st write-output that Ive placed to trace where the process flows through, Ive found out that it doesnt enter or satisfy the IF statement. To view your current network configuration, use Get-NetIPConfiguration. For example just changing the spool folder on the print server - the registry is the fastest method. The Load Data from a Folder Source feature allows you to combine multiple files into a single data set to report within Power BI. Would the reflected sun's radiation melt ice in LEO? Or is it something specific to VMs that you had in mind? You go desperately through all your pockets, but they are nowhere to be found. Thanks for the code btw. You can do so much more with DNS records with PowerShell. However, I read a couple of articles refering to Set-VMGuestNetworkInterface not being supported on windows 2008 with powercli 4.1.x. Given a large enough number of servers, your house would crumble to dust before you were done. I will try it using a csv file and report back. But how do I get the value/s of the property/ies (like InterfaceIndex and InterfaceAlias) of Get-Netadapter and use it/them, say move the value/s to a variable/s? New-NetIPAddress. However, Ive just found out that the parameters -MaskInput and -AsPlainText are only available in PowerShell 7.0. Welcome to another SpiceQuest! The port that is assigned to the printer on the ports tab. Thank you! Client desktops, tablets, mobile and desk phones, servers and more all consume IPs. Author is not liable for any damages whatsoever arising out of the use of or inability to use the sample scripts or documentation. Well, I also introduced you to filtering. Get-ADComputer -Filter * | ForEach-Object {Set-DNSIP -Name $_.Name -NetworkName Ethernet -DnsIPs 192.168.33.11}. NSlookup. The printer port is a separate object. How can I explain to my manager that a project he wishes to undertake cannot be performed by the team? Although I had written this scriptaround 4 years back I have againrevised it to work it in more better way with status report on console. For that, you can search for powershell and click the Run as Administrator option. When you want to run the function, import the module (Import-Module 'C:\temp\MyCustomfunctions.psm1") and then the function will be available. Finally, we update it again (this time to 10.0.1.102), using the Verbose switch. This cmdlet, in a word, is awesome. If I throw a stick Id easily hit a couple of Win2003 Servers. This cmdlet uses CIM and WMI (DCom and winrm) protocol to connect remote computer. If my guess is correct, the code you provided will dump all of whats contained in Get-NetAdapter. The function below helps you to update the IP address of a specific computer on a specific NIC. https://gallery.technet.microsoft.com/scriptcenter/Powershell-script-to-69903f6c Opens a new window. Highlight a Row Using Conditional Formatting, Hide or Password Protect a Folder in Windows, Access Your Router If You Forget the Password, Access Your Linux Partitions From Windows, How to Connect to Localhost Within a Docker Container. Im surprised by the behaviour, I didnt get such behaviour. By the looks of it, yes, you are right. It takes care of things like the installation of AD, and the configuration of the new file share on the file server. To retrieve the data related to DNS client IP settings including domain name like Ipconfig /all command, we need mainly 3 commands. I have tried looking at several different scripts but can't seem to get anything to work successfully. What if theres more? .. Run a second dos script the only purpose of which is to verify that PowerShell changed the dns settings. How will I be able to capture it if its not on the 1st record? 4sysops - The online community for SysAdmins and DevOps. (Get-NetAdapter).InterfaceIndex or save everything in a variable and then use it in a similar way. You don't need ping for this, and you don't need to allow all inbound traffic in the Windows Firewall. Specifies a PolicyStore value. Now we need to go back and change all the IP printer ports for those printers to point to the new IP. They don't have to be completed on a certain holiday.) The cmdlet modifies the IP address configuration that matches the families. Hi, very helpful. $info = Get-NetAdapter -CimSession Dc01,FS03. (If you're interested in Get-IPAddressPretty, give us a shout and I'll create a quick post about it, too.) The NIC we're interested in has the current IP address 10.0.1.51. This command will flush the DNS. He is currently involved in a deployment project for the European Commission and focuses on Active Directory, Group Policy, Azure, and automation with PowerShell. I have an assignment at my work where we need to change the static IP addresses (not DNS) on several computers. Unfortunately, I know from experience the feeling of clients with old stuff. Runs the cmdlet in a remote session or on a remote computer. To learn more, see our tips on writing great answers. Admitting again that Im a newbie in PowerShell coding, I wanted to create codes to verify equality of passwords being entered. Preferred. If you have a look inside one of these BAT files, you'll see that this also uses the netsh command, Blog: lucd.infoTwitter: @LucD22Co-authorPowerCLI Reference. Specifies the maximum number of concurrent operations that can be established to run the cmdlet. Create a new binding for https in IIS. DNS server scripts. Normally, the DCs are DNS servers, too. Once you've provided all these bits of information, the function will attempt to connect to the target computer. Well, seeing as i wasn't the one who built the initial setup, the host name thing really wouldn't have helped. Read more We have already shown you how you can change your IP address from the command prompt, which required long netsh commands, now we are doing the same thing in PowerShell, without the complexity. This is physical network adapter name on the windows server or desktop, By default 2012 and above windows OS network name is Ethernet. If a Windows service hangs, restart the service with PowerShell, Install, remove, list, and set default printer with PowerShell, Format time and date output of PowerShell New-TimeSpan, https://docs.microsoft.com/en-us/powershell/module/nettcpip/new-netipaddress, https://docs.microsoft.com/en-us/powershell/scripting/windows-powershell/wmf/setup/install-configure. To be honest, I try to keep away from older OSes as much as possible, Some info is available here (including download links): https://docs.microsoft.com/en-us/powershell/scripting/windows-powershell/wmf/setup/install-configure. I would use the Invoke-VMScript cmdlet to execute the IP settings change inside the guest. Join 425,000 subscribers and get a daily digest of news, geek trivia, and our feature articles. Your daily dose of tech news, in brief. : 10 Early incorporated entities were established by charter (i.e., by an ad hoc act granted by a monarch or . . Remove-NetRoute. Set DNS Server. To set the DNS servers addresses using PowerShell, use Set-DnsClientServerAddress with the following syntax. (Im not affiliated in any way with them, but it helped me and I learned a lot). If Verbose mode is selected, you will be informed about these old addresses, too. It displayed this: InterfaceAlias PSComputerName RunspaceId - Ethernet 2 Win10VMTest004 ffd983d1-21bf-42af-b123-bb0ec402dd3f Ethernet Win10VMTest004 ffd983d1-21bf-42af-b123-bb0ec402dd3f. You can use the Windows Management Instrumentation (WMI) to accomplish this. . You could try to install PowerShell 5.1 on Windows 7. Hi All, I have a task to change the ip addresses of multiple windows operating systems ip address from DHCP to Static. Thanks for the code. I say should, because I havent tested on Win7. If the IP address is different, the function will perform the following: Remotely updating and IP address with Update IPv4Address. Thanks for your help. This command adds the IP address 192.168..1 to the interface located at index 12. rev2023.3.1.43269. The acceptable values for this parameter are: Specifies an array of duplicate address detection (DAD) state values for the IP address. Summary: Use Windows PowerShell to set the primary and secondary DNS server addresses for a client. How to Use Cron With Your Docker Containers, How to Check If Your Server Is Vulnerable to the log4j Java Exploit (Log4Shell), How to Pass Environment Variables to Docker Containers, How to Use Docker to Containerize PHP and Apache, How to Use State in Functional React Components, How to Restart Kubernetes Pods With Kubectl, How to Find Your Apache Configuration Folder, How to Assign a Static IP to a Docker Container, How to Get Started With Portainer, a Web UI for Docker, How to Configure Cache-Control Headers in NGINX, How Does Git Reset Actually Work? By clicking Accept all cookies, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy. PARAMETERS
is there a chinese version of ex. What I need is to do something once I catch InterfaceAlias value of Ethernet 2, and its basically using the InterfaceIndex value of 7 somewhere down the road. The good news is I got it working using set-vmguestnetworkinterface as a standalone. I have a powershell script which I tried to archieve this with. rev2023.3.1.43269. Specifies an array of IP address types. Tried that..not sure how to adapt it to my need. -- Link. Creating Powershell script to change IP Address. Take Screenshot by Tapping Back of iPhone, Pair Two Sets of AirPods With the Same iPhone, Download Files Using Safari on Your iPhone, Turn Your Computer Into a DLNA Media Server, Control All Your Smart Home Devices in One App. This parameter defines the local subnet size, and is also known as a subnet mask. Yes it does. This assumes the following: The . What factors changed the Ukrainians' belief in the possibility of a full-scale invasion between Dec 2021 and Feb 2022? This is great help. The previous section covered the basic updating of the DNS servers locally on a single computer. Required fields are marked *. The new IP Address it will use will be the value that was originally provided by DHCP. And I also mentioned there are more ways, and that you should use the most suitable one for each case. Thanks for contributing an answer to Super User! I deal with people that have lingering old OSes so I try to figure these out. Retrieve the current price of a ERC20 token from uniswap v2 router using web3js, Change color of a paragraph containing aligned equations. Ok let me ask you that, what is the OS of the server? My question is how to incorporate a ForEach that allows for every server in the 'serverlist.txt'. To be honest, Im not very sure about what youre doing (like what is $InterfaceIndex4Set). Is email scraping still a thing for spammers, Am I being scammed after paying almost $10,000 to a tree company not being able to withdraw my profit without paying a fee. Printing with Powershell is less than straightforward. Get-NetIPAddress gives IP address information with prefix length and address family. Good job. Finally if their are multiple dhcp addresses prompt/log and proceed the list. -Name =Put computername here
Do you have any other ideas on how I can achieve this objective. This single cmdlet allows your script to reach into the guest operating system, and execute a block of code. You will then call EnableStatic(IP, Netmask) on it and WELLA! The IP address information is valid. Disable DNS registration (if prompted to do so). The caveat with remote WMI is that the remote targets have to be remote-enabled and that you need an account that has permission to access the remote WMI namespace. -DnsIP = here you can put multiple ip in array with @()
To no avail. Do you see any issues with me passing the commands from powercli 5.0. Take a look at those IP addresses to make sure nothing critical has been added and then enable the firewall rule. The only way to manage IPs at this level is to use Microsoft Dynamic Host Configuration Protocol (DHCP), which will also manage which devices obtain which IPs through DHCP leases. First, you can use the printer cmdlets. But you might not know the IP address of the remote computer but you sure do know the name, this should work too. You will first use a query to obtain the correct WMI object that allows you to tweak IP settings. Remotely changing the IP on a server will cause the server to become unresponsive. Well, my situation is that I need to run your commands outside the VM. I am thinking something like: script.ps1 -ComputerName (Get-Content c:\serverlist.txt) -OldDns 10.0.0.1 -NewDns 10.0.0.2. Invoke-Command is now my new best friend! Rather than change the DNS servers via the GUI, we can save a lot of time and effort by modifying the interfaces via PowerShell. Pluralsight is not free, but its completely worth the investment, and its roughly the cost of a Netflix subscription. Usage of cookies:In order to optimize the website and for continuous improvement vcloud-lab.com uses cookies. Step 1: After logging into the Action1 dashboard, in the Navigation pane (the left column), select Managed Endpoints and mark the endpoint to change DNS remotely. Specifies an array of IPv4 or IPv6 addresses. Use client source IP address for backend communication in a v4-v6 load balancing configuration . Why was the nose gear of Concorde located so far aft? Note: The following commands are new in PowerShell v3 and therefore require Windows 8, they also require an administrative command prompt. Thats all there is to it. Prompts you for local or remote computer hostname, Computername parameter is an alias, This value can be taken from pipline by property name. To obtain a TimeSpan object, use the New-TimeSpan cmdlet. The first command creates a new TimeSpan object of one day, and stores it in the variable named $Timesp. Either will work. Usually that happens right before you plan to go on vacation, or immediately after. I recently have a task to review the DNS settings for more than 100 Windows servers in the same domain. There are a few parameters the function expects you to provide: You can get more information by using Get-Help Update-IPv4Address. Your replies are always very helpful and enlightening. PS C:\> New-NetIPAddress -InterfaceIndex 12 -IPAddress 192.168..1 PS C:\> Set-NetIPAddress -InterfaceIndex 12 -IPAddress 192.168..1 -PrefixLength 24. How can I explain to my manager that a project he wishes to undertake cannot be performed by the team? You can also disable DHCP and even clean up the old IP addresses from the DNS. I mentioned them here just to show there are more ways to accomplish something. If it is, you'll be prompted about this, and the function will stop. Shows what would happen if the cmdlet runs. When the computer restarts, it copies the saved settings to the ActiveStore. As stated in the title of this post, we are running Windows 2012 R2 as the OS for the print server so Powershell is likely the tool we will use if/when I get a script capable of reading a CSV, removing the old IP port, add a new port, and then assign the printers to use the newly created port. I passed the commands successfully with powercli 5.0, previous versions won't play ball. You need to specify this with the value "Yes;" otherwise, DNS registration will not be disabled. PTIJ Should we be afraid of Artificial Intelligence? IP address configuration information for addresses that are valid and available for use. I learned it through Google. Does Cast a Spell make you a spellcaster? Can someone help me read in a csv file with old IP and new IP to change all these printer queues to use the new IP ports? Ever faced the challenge of searching for the DNS record to change the IP, well Powershell has made it so easy and reliable this script is a better example of it. With a sigh, you are about to go digging through all the lost crannies in your bag when the boss pops in and reminds you that those application servers need their public-facing NICs moved to a new address space. The -ComputerName will be $_ which is the current item in the pipeline. Using these commands, we can set various network configurations and settings more easily from a PowerShell script. This will change the DNS address then flush the DNS cache once. . In the printing cmdlets, Each printer object has a Port. Is there a way to create a powershell script to change the static IP address of a specified computer to a new address? We can use the Server Manager GUI, but it's easily done with a PowerShell command: Add-WindowsFeature -Name Print-Server. The cmdlet modifies IP addresses that match the indexes. The second part uses a WMI cmdlet (which I suggest). This fails if there are multiple servers in the . We will see each command one by one. Asking for help, clarification, or responding to other answers. This way we can check if we are connected to the local network, have access to internet and are able to resolve DNS names. please do everything in your power to correct me if I saying or doing something wrong, or inform me of what I could be doing better. Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to set the static IP and DNS addresses on a server. Am I dealing with an array when I access the contents of Get-NetAdapter? Then type the command and have fun with it. Assuming you had a CSV with the properties: PrinterName, OldPortName, NewPortName,NewPortIPAddress, then you should be able to do something like this: You could use Remove-PrinterPort to remove the old ones, and Add-PrintrerPort to add the new one. Specifies the input object that is used in a pipeline command. This script is based and built usingCIM cmdlets.