none
Script to find details ip address RRS feed

  • Question

  • Hello ,

    Input text file will contain hostnames (servers )

    Could you please help to check if OS Version , ip address , subnet mask , default gateway , dns can be captured in csv format

    Regards,

    Ajit


    Regards, Ajit

    • Moved by Bill_Stewart Monday, September 11, 2017 3:14 PM This is not "scripts on demand"
    Wednesday, July 5, 2017 8:25 AM

All replies

  • Please look here for pre-written scripts:  http://gallery.technet.microsoft.com


    \_(ツ)_/

    Wednesday, July 5, 2017 8:29 AM
  • your input file is in free text or in a defined format .

    if your file contains defined format you can use the regular expression to get the data from the input file .I have just find the below way on internet to dump the data in csv.

    $ips = @('IP_10.57.50.91',
        '10.57.50.73',
        '10.58.4.37 IP',
        'ip 10.63.1.22',
        'hostname300',
        'ip 10.63'
    )

    $regex = [regex] "\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b"

    $regex.Matches($ips) | %{ $_.value }

    once you are able to get the data you can dump in to csv.

    $U_Name = "Subnet"
    $Ipaddress = "your ipaddress"

        $column = @{
             "Users" =  $U_Name
     "Groupname" = $G_Name
                 }

    $Row = New-Object PsObject -Property $column
    Export-Csv -Path "\path of csv file" -inputobject $Row -append -Force


    Prashant Dev Pandey LIVE IN YOUR OWN WAY Please remember to mark the replies as answers if they help

    Wednesday, July 5, 2017 9:40 AM