I know what I want to do, which guides to teach me.

I have use of being able to find out exactly what port on our switches at work an IP address is using (even if the IP is no longer responding)

I have the rights to do what I need and I know the commands to do what I need, but I really ought to learn how to merge them all together.

So I need to powershell talk to the DHCP server, pull the mac address against an IP lease.

Once I have the mac (probably in the format aa:xx:zz:yy:00 or 0040201a6b1a) I then need to convert it to xxxx.xxxx.xxxx

Then I need to ssh in to the switches at work and type in

show mac address-table | i <xxxx.xxxx.xxxx>

(This is where the different mac format is required)

.

When I do this, one of 16 switches will respond with a “STATIC” flag and then the port it’s on.

I’d like this dropped to, well I guess 16 text files, whcih I can then discard all the ones returning nothing or “DYNAMIC” and then see the final one.

.

.

I’m sure there’s better ways to do this but I can comprehend the logic of doing it this way.

.

I guess the key thing here, isn’t just typing a command and pulling a value, but it’s pulling a value and then being able to inject that value into the next command.

Any thoughts on where I should start?

submitted by /u/Sys6473eight
[link] [comments]

Leave a Reply