PowerShell Quick Tips : Get-NetIPConfiguration instead of IpConfig

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hi and welcome to this Powershell quick tip video today we're going to be taking a look at the commandlet forg net IP configuration and what we're really looking to do is use this commandlet in lie of IP config ip config is not a Powershell commandlet so the uses are very limited in your scripts if you want something to be automated that has something to do with the IP configuration on the computer or if you want to do some remote execution on code and get some data back sure ip config can work but it will create you probably a lot more headaches than anything then with the get net IP configuration we can use variables you can specify specific properties that you want to pull back so let's first go ahead and let's just look at the old method of using ip config here and just seeing what it gives us so if we type in ip config here and I'm just running as administrator on Powershell 7 even though ip config is not a Powershell commandlet you can still run normal um commands in Powershell um just once again none of these will have parameter like Properties or anything like that so you can't like filter it very nicely but here is our IP config we can see that we do get our wireless land adapter we can see our ipv4 address our default gateway so it is very good um we can even do ip config SL all to get a little bit more data here and here we can even see again the wireless landan adapter and we can see all the info on it including the DNS servers that's configured the subnet mask whether it's DHCP we can see the physical address or the MAC address of the card itself as well but let's go ahead and let's take a look at the commandlet version here so get n IP configuration here and we can actually run this to get the information now I know that ip config can do a lot of renew and release info this is purely strictly to actually go and retrieve data so here we can get the get net IP configuration um and we can see our EET card we can see our WiFi card as well and we can see our IP address our Gateway and we even see our DNS servers here now what we can actually do is filter it down to just the Wi-Fi card as well by just specifying an interface Alias and doing Wi-Fi and we can easily get that back without really too too much work and what we can even do is add a dash detailed to this and what this will do it will add even more information so here we actually get back the MAC address as well we even get back the computer name if we would want it um the DNS servers we still get we get the Gateway the IP address what type of connectivity um the ipv4 has so we have internet connectivity on the ipv4 and we have nothing on IPv6 we are domain authenticated we even get the profile name and we get that the status of the network adapter is actually up which is great now what we can even do is you can assign this to a variable so if we assign this to IP info and we just make that equal there and we do an IP info we get all the data back and we can even do IP info. IP address and we get more information not just the IP address but we actually get more interation more information on that IP address itself now this might be a little bit specific but it will tell us that it is a type of unicast it gives us the prefix length as well and we can even go further and do IP address here and this will actually give us just the IP address which then we could use that in scripts or anything if we want to type that to some type of database or some type of elastic search maybe we want to just contain every IP that a computer has in our elastic this way we have historical records of it that would be one of the use cases here um but there are a lot of different things that you can look at so if we just go back to our getet IP configuration here as you can see we also have these interface indexes which are very very useful to have um so instead of doing the interface Alias of Wi-Fi we can even do an interface index of 7 here and that will get us back just the Wi-Fi and of course let's say we didn't know what the interface index we didn't know what the Alias was we can easily pipe that to where and then let's just say well we know what we're looking for um might be something like Wi-Fi might be something like Ethernet or something so we can say where e interface Alias Dash like and we do our set of double quotes here let's just say anything that's like ether so that would pick up anything that's like ethernet and there is our two ethernet connection so we can actually see that on this computer we actually have a virtual box ethernet adapter but we also have our regular ethernet adapter here as well and we get the two interface indexes for either or so this could lead us on to a better search maybe we wanted to search specifically that virtual box adapter perhaps uh which that has the interface index of 18 um so we can do the interface index of 18 and then we can do detailed on that and now we get all of our details on that specific inter so you don't necessarily have to know or maybe you can even do the we interface description CU if you maybe know what type of Wi-Fi adapter you have in my case let's do a dash like in my case I know that it is an Intel uh let me just see here I don't like when it does doesn't show us oh that's cuz I did the Stars at the wrong spot here so if I pull out anything that is a Intel card here I will see that we get the Wi-Fi and ethernet now what we can even do is we can limit it on um where the um maybe we want to limit it on it's a Intel and we want to make sure that it is is wireless and there is our sole Wi-Fi card so there are a lot of easy and neat options with the get net IP configuration commandlet which can easily replace your getting information from ip config which can be very very helpful if you're trying to automate some scripts with Powershell for getting that type of information can be very useful especially if you're a network administrator Security administrator or system administrator and as well this is something that you can use on your Windows 10 and windows 11 box again as you probably noticed in the last couple videos I kind of try to make some of these just in case that some people can't bring up a virtual machine with Windows server on it this is a great way again to practice your Powershell skills with a limited availability to machines or tools you can definitely use these and just practice piping practice your commandlets just practice in general maybe you're going to want to grab this information and pump that to a text file or a CSV file and keep track of it maybe you don't assign static addresses to your computers maybe you can write a script that will constantly just log every single IP address that your computer has ever had into a text file that could easily be something that you can do with this command lint very easy easily now that was it for the getet IP configuration commandlet do you guys have any commandlets that you guys would like me to do a quick tip on just let me know in the comment section down below if it is part of a specific module please let me know the module name as well so I can easily find it and this way we can share it to the community and everyone can benefit from these really cool commandlets if you haven't already please hit that subscribe button hit that like button also don't don't forget to hit that notification Bell to be notified when that next video comes out and I will see you guys on the next video
Info
Channel: JackedProgrammer
Views: 759
Rating: undefined out of 5
Keywords: powershell basics, powershell, windows powershell, programming, scripting, powershell scripting, powershell scripting tutorial, powershell tutorial, how to, powershell api responses, powershell automation, powershell beginners, powershell variables, quick tips powershell, quick tips, learn powershell, powershell for beginners, powershell commands for beginners, active directory, windows server, automation, windows 11, windows 10, get-netipconfirguration, ipconfig
Id: 0sviofyaTqo
Channel Id: undefined
Length: 9min 37sec (577 seconds)
Published: Mon Jun 10 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.