Getting *NIC info from remote machines on network?

so I'm a systems engineer and am trying to make my job a little easier. Our scripter here doesn't have the time to get to me because he's often very busy so I was hoping someone here could help me out. I know a little powershell but not to the extent I'm trying to use it.

What I'm attempting to do is use a predefined list of IP addresses and get all network interface card information from them. I tried writing a couple scripts myself, however they messed some stuff up so that wouldn't fly. I bought a script, but it only does 1 machine at a time and takes about 2 minutes per machine. I basically need an autonomous script that will do this and output the information so I can give it my network guys.

I'm not asking for someone to write the entire script, but rather give me some guidance or a couple examples?

Here's what I have. I want to make it read from a file though and just do it autonomously.

http://pastebin.com/dVEDM4Kd

Answers


If you just want to iterate your current script through a list of IPs, you need to wrap the script in a ForEach loop, then at end of the script pipe that object out to a text file.

To load the IP addresses from a text file, just create a new file with one IP per line and use Get-Content to load the file into the script for use.

You will need to change the top of your script like so,

 #This is the file where your IP or Computernames will go.
    $IPAddresses = Get-Content 'c:\test\servers.txt'


    $myCol = @()

    # this Foreach will take each item that is in $ipaddresses and assign them to 
    # $servername one at a time and run the code within the block for each item in 
    # IPAddresses.  $servername was the var name already so I just rolled with it

   ForEach($servername in $IPAddresses){

    $NicConfig = Get-WmiObject -Class Win32_NetworkAdapterConfiguration -ComputerName $serverName


    ForEach ($Nic in $NicConfig)

and at the end to send all that collected data out to a file just alter the last line like so:

    $myCol | Out-file 'C:\test\Outfile.txt'

Since it was pretty straight forward, I went ahead and created a copy of your script with the changes. This might meet your needs but if not it should get you started.

http://pastebin.com/HY9e5x1V


Need Your Help

How to do a people detection and counting using JavaCV

detection javacv cctv

is there any classes in javacv to count the number of people or detect people in a certain location which we define on the video? Simply what i am doing is upload a video to the system and identify...