Issue Exporting TCP IP stack information to CSV file

I'm having difficulties reporting IP information (IPAddress, Default Gateway,
and DNSSearchOrder) in TCP IP stack and exporting it to CSV file.  But if I remove the export-CSV statement everything appears fiine on the screen.  for privacy reasons I've removed columns after DNS Search Order.  note my examples below:
Get-WMIObject -Class Win32_NetworkAdapterConfiguration -ComputerName (Get-Content .\Servers.txt) -Credential DOMAIN\USERADDCOUNT |
Where-Object -FilterScript {$_.IPEnabled} |
    Select-Object DNSHostName, IPAddress,  DefaultIPGateway, DNSServerSearchOrder, WINSPrimaryServer, WINSSecondaryServer,
@ {Label="ADSDomainName";Expression={(Get-WMIObject -Class Win32_ComputerSystem -ComputerName $_.__Server).Domain}} |
     Export-csv PowerShell-ServerProfileIPInformation.csv -NoTypeInformation
DNSHostName    IPAddress         DefaultIPGateway DNSServerSearchOrder
SERVER1100496 System.String[] System.String[]    System.String[]
SERVER1100497 System.String[] System.String[]    System.String[]
SERVER1100169 System.String[] System.String[]    System.String[]
SERVER1100496 System.String[] System.String[]    System.String[]
SERVER1100497 System.String[] System.String[]    System.String[]
SERVER1100169 System.String[] System.String[]    System.String[]
SERVER1100496 System.String[] System.String[]    System.String[]
SERVER1100497 System.String[] System.String[]    System.String[]
SERVER1100169 System.String[] System.String[]    System.String[]

Hi,
This is happening because you are trying to export a array. Simple way to get rid of this is, convert the array into comma separated values and then export it.I slightly modified your code as below.
$IPs = Get-WMIObject -Class Win32_NetworkAdapterConfiguration -ComputerName (Get-Content .\Servers.txt) -Credential DOMAIN\USERADDCOUNT | ? {$_.IPEnabled }
$Outarray = @()
foreach($IP in $IPs) {
$OutputObj = New-Object -TypeName PSobject
$OutputObj | Add-Member -MemberType NoteProperty -Name ComputerName -Value $IP.DNSHostName
$OutputObj | Add-Member -MemberType NoteProperty -Name IPAddress -Value $IP.IPAddress -join ","
$OutputObj | Add-Member -MemberType NoteProperty -Name DefaultIPGateway -Value $IP.DefaultIPGateway -join ","
$Outarray += $OutputObj
$OutArray | export-csv c:\temp\IPdetails.csv -NoTypeInformation
If you want to understand more on how to export such kind of data to csv/excel, refer to this(http://learn-powershell.net/2014/01/24/avoiding-system-object-or-similar-output-when-using-export-csv/) article written by Boe Prox. It is really worth reading.
If you are looking for complete script that can export Ip config details of remote computers into CSV, try the script mentioned at
http://techibee.com/powershell/powershell-get-ip-address-subnet-gateway-dns-serves-and-mac-address-details-of-remote-computer/1367
Hope this helps.
Thanks,
Sitaram Pamarthi
Blog : http://techibee.com
Follow on Twitter
This posting is provided AS IS with no warranties or gurentees,and confers no rights

Similar Messages

  • I am trying to export a Numbers spreadsheet to a csv file, but it does not put the commas in

    I am trying to export a Numbers spreadsheet to a csv file, but it does not put the commas in.  I want to use it with an HTML table generator tool, but the tool is looking for commas.   The Export to CSV exports it as a spreadsheet with all the formatting removed, and no commas.
    Here is the html table tool:
    http://www.textfixer.com/html/csv-convert-table.php

    Numbers '09 create CSV files with comma separated values if and only if your system is using decimal period.
    If the system is using decimal comma, the CSV files are created using semi-colon as separator.
    Yvan KOENIG (VALLAURIS, France)  dimanche 11 décembre 2011 11:11:25
    iMac 21”5, i7, 2.8 GHz, 12 Gbytes, 1 Tbytes, mac OS X 10.6.8 and 10.7.2
    My iDisk is : <http://public.me.com/koenigyvan>
    Please : Search for questions similar to your own before submitting them to the community

  • Updating information in .CSV file - ongoing report

    i have a script im running that gives me a report of machines currently available on the network and exports that information to a .csv file 
    What im trying to accomplish is AFTER the initial run of the script if the script runs again and the machine is available i would like that cell to update with AVAILABLE as opposed to writing a whole new line item.
    I hope thats a clear explanation. I'm assuming if i use the -append flag it will create new line items which im trying to stay away from as i'm sure this will come in handy when running some dynamic html reporting pages
    here is my current script
    Function get-mdtbuiltcomputers {
        param (
            [string[]]$computername='localhost'
        foreach($comp in $computername){
            $p=[ordered]@{
                Computername=$comp
                Status='Unavailable or not a Standard MDT Image'
                MDTImageDate=$null
            $path=Test-Path "\\$comp\c$\Windows\smsts.ini"
            $connected = Test-Connection -quiet -count 2 -delay 2 -ComputerName $comp
            if($path -and $connected){
                $file=Get-ChildItem \\$comp\c$\Windows\smsts.ini
                $p.Status='Available'
                $p.MDTImageDate=$file.CreationTime
             New-Object PsObject -Property $p
    when i run it from my console i use:
    get-mdtbuiltcomputers -computername xxxxxxx | export-csv c:\mdt.csv -notypeinformation
    Rich Thompson

    Hint:
    if($p=$csv|?{$_.ComputerName -eq $comp}){
    $reuse=$true
    }else{
    $p=[ordered]@{
    Computername=$comp
    Status='Unavailable or not a Standard MDT Image'
    MDTImageDate=$null
    if(-not $reuse){
    # append to existing CSV
    }else{
    # do nothing
    ¯\_(ツ)_/¯

  • How To Export from Mac address book to CSV file

    In Mac's address book: How do you export a highlighted group of *contacts to a cvs file* (so that I can import in groups by my categories into Google contacts- that way it is easier to sort/designate the contacts one I get the contacts there into Google).
    I can sync them all- but then I'd have to put them into their categories one at a time, there are too many...
    thx missy
    (I'm used to ms office and pc's)

    Okay, *I got this issue worked out;here's how.* (Unfortunately the mac app AB2CSV doesn't open up to the screens it's supposed to in order to choose and convert or save contacts to a csv file and did crash my address book- which was very scary to see my 1533 contacts vanish!! )
    Luckily somehow I had made an archive file of them all and got them back into my mac Calendar unscathed -so I lucked out...
    Today at my local Apple Store in Nashville *I was shown a better way-and I'm glad to share this with you*:(They also set up my mobile me and my itouch to sync my contacts and emails too-plus got my contacts synced up to my GoogleApps acnt- so now I am in the clouds, backed up, and liberated-in spite of myself!!)
    *iWorks Numbers* works similar to msExcel, so you *open up Numbers* ;get on to a *new blank page*;also *open Address Book* and highlight the contacts from your address book and *drag them right on to your Numbers page*; like magic it looks like an excel spread sheet (you can choose the columns/headers you want to use ie name,phone #,street,city, email, etc even the notes); then you go up to *Share in the menu*; *choose csv file*; and *save it*...Thank you Apple store Green Hills!! you saved me today!!

  • Exporting MySQL db content to a csv file

    Hello,
    I have written the below script to read from a MySQL db and then create a csv file and insert data into the file, however i am facing a issue that each coloun data is represented in a new row. Please help.
    [void][system.reflection.Assembly]::LoadFrom("C:\Program Files (x86)\MySQL\MySQL Connector Net 6.2.5\Assemblies\MySql.Data.dll")
    $myconnection = New-Object MySql.Data.MySqlClient.MySqlConnection
    $myconnection.ConnectionString = "server=19x.8x.16x.217;user id=xxxx;password=xxxx;database=inventairesv2;pooling=false"
    $myconnection.Open()
    $mycommand = New-Object MySql.Data.MySqlClient.MySqlCommand
    $mycommand.Connection = $myconnection
    $mycommand.CommandText = "SELECT * FROM legacy2"
    $myreader = $mycommand.ExecuteReader()
    while
    ($myreader.Read()) {
      for ($i= 0; $i -lt $myreader.FieldCount; $i++) {
        write-output $myreader.GetValue($i).ToString()|Out-File "R:\PBOX\legacy.csv" -Append
    Output from the script :
    Weblogic
    9
    01/11/2011 00:00:00
    01/11/2011 00:00:00
    2
    NGC
    domaine_ngca
    Retired
    Weblogic-9.2.2
    1
    Développement
    dngc01
    Weblogic
    9
    01/11/2011 00:00:00
    01/11/2011 00:00:00
    2
    NGC
    domaine_ngca
    Retired
    Weblogic-9.2.2
    2
    Développement
    dngc01
    Weblogic
    9
    01/11/2011 00:00:00
    01/11/2011 00:00:00
    2
    NGC
    domaine_ngca
    Retired
    Weblogic-9.2.2
    3
    Développement
    dngc01
    Weblogic
    9
    Output desired:
    Weblogic;9;01/11/2011 00:00:00;01/11/2011 00:00:00;2;NGC;domaine_ngca;Retired;Weblogic-9.2.2;1;Développement;dngc01
    Weblogic;9;01/11/2011 00:00:00;01/11/2011 00:00:00;2;NGC;domaine_ngca;Retired;Weblogic-9.2.2;2;Développement;dngc01

    Hello Brian,
    I have tried the above script as well, but still getting the same message and also in the data exported out i see that the Date/Time field now has inconsistent values shown below.
    I still get the Exception Message:
    ========================================================================
    Exception calling "GetValue" with "1" argument(s): "Unable to convert MySQL dat
    e/time value to System.DateTime"
    At R:\CIT-uCMDB\scenario_CIT_SG_UCMDB10_DEV\PBOX\P-Script\PBOX.ps1:14 char:34
    +      $Value =  $myreader.GetValue <<<< ($i).ToString()
        + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
        + FullyQualifiedErrorId : DotNetMethodException
    Exception calling "Read" with "0" argument(s): "Fatal error encountered during
    data read."
    At R:\CIT-uCMDB\scenario_CIT_SG_UCMDB10_DEV\PBOX\P-Script\PBOX.ps1:10 char:22
    + while ($myreader.Read <<<< ())
        + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
        + FullyQualifiedErrorId : DotNetMethodException
    =====================================================================
    Informatica
    8
    31/12/2011 00:00:00
    31/12/2011 00:00:00
    2
    BOX
    REP_SOL10_HOF
    Retired
    Informatica 8.6.1
    2682
    Homologation
    hmid01
    Weblogic
    10
    1/3/2013 0:00
    2
    ERT
    domaineERT
    Retired
    Weblogic-10.1
    2690
    Homologation
    pwlslx11,pwlslx12,pwlslx13,pwlslx14
    Weblogic
    10
    1/3/2013 0:00
    2
    ERT
    domaineERT
    Retired
    Weblogic-10.1
    2691
    Homologation
    hertlx01
    Apache httpd Server
    2.2.8
    2.2.8
    2.2.8
    4
    ERT
    domaineERT
    Supported
    Apache http Server 2.2.8
    2692
    Homologation
    hertlx01
    Apache httpd Server
    2.2.8
    2.2.8
    2.2.8
    4
    CLT
    domaineCLT
    Supported
    Apache http Server 2.2.8
    2694
    Développement
    dcltlx01

  • How to export out the date into the csv file?

    Hi, I had been trying to export out the value of the date to csv file.
    This is the  script:
    $strADPath = 'LDAP://dc=test,dc=com'
    function ConvertLargeIntegerToDate([object]$LargeInteger){
    try
    $int64 = ConvertLargeIntegerToInt64 ($LargeInteger)
    if ($int64 -gt 0)
    $retDate = [datetime]::fromfiletime($int64)
    else
    $retDate = $null
    return $retDate
    catch
    return $null
    $objSearch = New-Object DirectoryServices.DirectorySearcher
    $objSearch.Filter = '(&(objectClass=user)(samaccountname=user1))'
    $objSearch.SearchRoot = $strADPath
    $objSearch.PageSize = 1000
    $objSearch.SearchScope = "subtree"
    $objResults = $objSearch.Findall()
    $dateAccountExpires = ConvertLargeIntegerToDate $objUser.accountexpires[0]
    Write-Host "date Account expires: " $dateAccountexpires
    $objResults| ForEach-Object{
    $_.GetDirectoryEntry()
    } |
    Select-Object -Property @{Name="sAMaccountName";Expression={$_.sAMAccountName}},
    @{Name="cn";Expression={$_.cn}},
    @{Name="name";Expression={$_.name}},
    @{Name="manager";Expression={$_.manager}},
    @{Name="givenName";Expression={$_.givenName}},
    @{Name="accountExpires";Expression={$_.dateAccountExpires}},
    @{Name="department";Expression={$_.department}} |
    Export-Csv -Path 'D:\test44.csv'
    This is what I get in PowerShell ISE:
    This is what I had get for the csv file for the expire date:

    hi FWN,
    the code had giving me error saying that it could not call method on a null-value expression.
    $temp = $_.Properties
    the code had gave error saying that it could not call method on a null-value expression.
    $properties | %{ $res.$_ = $temp.Item($_) }
    the code had gave error saying that it could not call method on a null-value expression.
    with lot of thanks
    noobcy

  • Exporting Quiz Results to Excel or .csv file

    I have a captivate file that I need to be able to export the
    data to a .csv file or a excel spreadsheet. I need to be able to do
    this as this is for a research project and will not be run with any
    network connectivity to an LMS. The data would then be imported
    into a database from that format. I would appreciate any help that
    someone could give me on this.

    Welcome to our community, David
    You may wish to review a Captivate Developer Center article
    that may help here.
    Click
    here to review the article
    Cheers... Rick

  • Export Failed.  Failed to write CSV file.  HELP!

    We are new to Numbers and were able to export a csv file of our data earlier.
    Now we get this error when I try to export. I can find no explanation and export attempts fail.
    Any ideas? Ultimately, I am trying to export a file of contact e-mail addresses.
    Export to PDF works fine.
    Export to Excel will work with this error:
    Export Warning - Header and footer cells were exported as body cells but will look the same.

    Hello md_raffiq81,
    As this requirement is related to PowerShell script, to receive better support, it is recommended to post in the TechNet Script forum.
    The professionals there will be glad to help you.
    https://social.technet.microsoft.com/Forums/Windows/en-US/home?forum=winserverpowershell
    Thanks for your understanding.
    Best regards,
    Fangzhou CHEN
    Fangzhou CHEN
    TechNet Community Support

  • Issue regarding 0 truncation for numbers in .csv file

    Hi
    I m loading data from .csv file say: Item Master Data.
    Our requirement is if customer sends item number as 0022 or 22 or 0001 or 1, we have to save & show same way.
    Let us suppose customer send us data with item number u2018001u2019 but as he makes .csv file, I get as u20181u2019 and not u2018001u2019, So I could load as u20181u2019.
    But if we rename customeru2019s csv file as .txt. And then open it in Excel with Item Number column as Text, we get '001'.
    But every day we can't do it manually for every file, Pls let me know if you find any solution on this.....
    Thanks...

    Did you try what i said? try this in dev.create a dummy item infoobject of type char and build a flatfile datasource only with this infoobject. Use your CSV file. In the file delete all columns except item and try to preview and see whether leading zeros are visible? If you are able see 00 in .txt format then this should work. Try and let me know.
    Edited by: Raghavendra Padmanaban on Feb 16, 2011 4:08 PM
    Edited by: Raghavendra Padmanaban on Feb 16, 2011 4:09 PM

  • How to export contacts and change vcf to csv file

    I need to export the contacts so I can make updates and import them into my marketing system. iCloud exports in only ,vcf, which cannot be imported anywhere I can find.( that is the entire file, not one contact at a time)  I am very frustrated and don't understand Apple using this format for exporting.Every other application I can think of uses .csv and none takes .vcf for import.
    Help!

    You might want to try an app that can export in CSV format, like My Contacts Backup.

  • How can we export table data to a CSV file??

    Hi,
    I have the following requirement. Initially business agreed upon, exporting the table data to Excel file. But now, they would like to export the table data to a CSV file, which is not being supported by af:exportCollectionActionListener component.
    Because, when i opened the exported CSV file, i can see the exported data sorrounded with HTML tags. Hence the issue.
    Does someone has any solution for this ... Like, how can we export the table data to csv format. And it should work similar to exporting the data to excel sheet.
    For youre reference here is the code which i have used to export the table data..
    ><f:facet name="menus">
    ><af:menu text="Menu" id="m1">
    ><af:commandMenuItem text="Print" id="cmi1">
    ><af:exportCollectionActionListener exportedId="t1"
    >title="CommunicationDistributionList"
    >filename="CommunicationDistributionList"
    >type="excelHTML"/> ---- I tried with removing value for this attribute. With no value, it did not worked at all.
    ></af:commandMenuItem>
    ></af:menu>
    ></f:facet>
    Thanks & Regards,
    Kiran Konjeti

    Hi Alex,
    I have already visited that POST and it works only in 10g. Not in 11g.
    I got the solution for this. The solution is :
    Use the following code in jsff
    ==================
    <af:commandButton text="Export Data" id="ctb1">><af:fileDownloadActionListener contentType="text/csv; charset=utf-8"
    >filename="test.csv"
    >method="#{pageFlowScope.pageFlowScopeDemoAppMB.test}"/>
    ></af:commandButton>
    OR
    <af:commandButton text="Export Data" id="ctb1">><af:fileDownloadActionListener contentType="application/vnd.ms-excel; charset=utf-8"
    >filename="test.csv"
    >method="#{pageFlowScope.pageFlowScopeDemoAppMB.test}"/>
    ></af:commandButton>
    And place this code in ManagedBean
    ======================
    > public void test(FacesContext facesContext, OutputStream outputStream) throws IOException {
    > DCBindingContainer dcBindings = (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
    >DCIteratorBinding itrBinding = (DCIteratorBinding)dcBindings.get("fetchDataIterator");
    >tableRows = itrBinding.getAllRowsInRange();
    preparaing column headers
    >PrintWriter out = new PrintWriter(outputStream);
    >out.print(" ID");
    >out.print(",");
    >out.print("Name");
    >out.print(",");
    >out.print("Designation");
    >out.print(",");
    >out.print("Salary");
    >out.println();
    preparing column data
    > for(Row row : tableRows){
    >DCDataRow dataRow = (DCDataRow)row;
    > DataLoaderDTO dto = (DataLoaderDTO)dataRow.getDataProvider();
    >out.print(dto.getId());
    >out.print(",");
    >out.print(dto.getName());
    >out.print(",");
    >out.print(dto.getDesgntn());
    >out.print(",");
    >out.print(dto.getSalary());
    >out.println();
    >}
    >out.flush();
    >out.close();
    > }
    And do the following settings(*OPTIONAL*) for your browser - Only in case, if the file is being blocked by IE
    ==================================================================
    http://ais-ss.usc.edu/helpdoc/main/browser/bris004b.html
    This resolves implementation of exporting table data to CSV file in 11g.
    Thanks & Regards,
    Kiran Konjeti

  • Importing users into WGM from csv file issues/crash

    Hi,
    i've been importing user information from csv files into WGM via the +server >  import+ function .
    It worked the first few times but now when i try the import progress bar pops up and promptly disappears without any thing importing.
    i've tried restarts, new admin account, reinstalled  WGM.
    I've also trashed some pref but i don't really know which ones i should be losing.
    The servers an OD master.
    any help would be appreciated.
    as a last resort what do i need to backup/save if i were to format/reinstall osx server? keeping my settings etc.....
    thanks
    paul

    What I did was:
    Exported the user list, to create an XML file in the correct format.
    Using this format, I created a spreadsheet in Excel (sorry Apple), and in the final column I created a field that concatenated the information I wanted in the ':' deliminated format of the previously export XML.
    Then just copy and past via pico into a pure text file and imported that.
    You have to be careful with comments in Passenger, using special characters (';!@#$%^ and others can cause the WGM to fail and crash.

  • How can I export a group email address to a .csv file. I can export the whole address book but it looses the group listings.

    I have an address book in Thunderbird and want to export one group listing to a .csv file. I couldn't find a way of exporting one group so exported the whole address book then opened the .csv file and was going to remove the all addresses except the group but the group name was not in the file.
    Is it possible to export the group listing.
    Thanks
    Ron

    Open Address Book, select the mailing list in the left pane, then Tools/Export, select csv (comma separated) format, name the file, click Save.

  • Ssrs 2008 export to excel and csv file

    In a ssrs 2008 report, the user will export data to PDF, excel, and CSV files. When the report is exported to excel or csv file, the user wants me to hide some tablixes. Thus can you show me code on how to export the reports to csv or excel file without
    and be able to hide a few tablixes?

    Hi jazz_dog,
    According to your description, you want to set the visibility for some tablixes based on the exporting file type. Right?
    In Reporting Services 2008, we don't have any parameter to get type of exporting file. So we can only create a parameter and select a type before exporting to a file. Then use conditional expression to control the visibility. It's definitely not a good workaround,
    so your goal can't be achieved in Reporting Services 2008. However, for Reporting Service 2008R2 or later version, we have a build-in parameter called Render Format Name, this parameter will display the type of exporting file automatically. So we can make
    the judgment in expression based on the value of this parameter.
    Reference:
    Built-in Globals and Users References (Report Builder and SSRS)
    If you have any question, please feel free to ask.
    Best Regards,
    Simon Hou

  • Addressbook cant read .csv-files exported from Numbers (Solved)

    Hello,
    I can hardly believe this myself, but please try. Numbers separates fields by semicolons while exporting my address data to a .csv file, which seems completely feasible to me. When trying to import this into Addressbook, the applications moans that it cant import this file because it is not valid.
    Do programmers from separate groups at Apple ever test whether their Apps work together? I just expect them to do so and I cant imagine a case more simple then that. This is really poor. The reason why I put this complaint in the Numbers discussion is, that there is no forum for Adressbook (whereas iCal got his own - why?).
    And the reason why I pick up this topic again in a new thread is that the other thread I found related to transferring data from Numbers to Addressbook took a weird twist when they resorted to writing a complicated and elaborate Apple Script for this basic task. The Script provided there messed up with valuable Address data in the first version, so I am not going to try it here.
    I just took the search and replace functionality of my text editor to solve it for me. But I still believe that this should work without headaches right out of the box. So Addressbook programmers please hurry up, go, fix it. It is just too distressing. Imagine, I did this in public with Windows guys around. I dont want to experience such again.
    Yours, Christian Völker

    Hello Yvan,
    yes, I agree that Numbers is doing fine and by your explanation I even know why it does the way it does, but Addressbook remains broken.
    Regarding your script I did not even bother to read it and I just dont trust it because I cant sue you in case something goes wrong. I prefer to do my own faults and in this case it was an even better and faster solution for me to use my text editor with search and replace.
    To make the story complete, after the data was accepted, Addressbook wasnt able to recognize the field labeled "Email" as an Email Address and Street as a Street Name. After telling Addressbook about the meaning of the fields, it consistently crashed while importing. No, this is no good. A Script wont heal these flaws.

Maybe you are looking for

  • Sending photos as attachments to email

    I need to send two .jpg photos that are in iphoto to someone. They are asking for them as attachments. How do I do this?

  • Songs have an exclamation point !

    Randomly, songs that were ripped from CDs that I created from Windows Media Player are developing an ! and are not able to be played. They somehow get moved to an "Unknown Artists" folder and itunes can't find them. I just had 148 songs change from b

  • The SELECT .... DISTINCT TOKEN_TEXT... consumes a lot of CPU.

    RDBMS: 10.1.0.5.0 Today, our db stopped to work. The load of the system (top) was 16 and the AWR report says that the top SQL (SQL ordered by CPU Time) is: SELECT   /*+INDEX(T "DR$DBY_DB_DATA_IX$X")*/   DISTINCT TOKEN_TEXT FROM "DR$DBY_DB_DATA_IX$I"

  • Complex EVDRE column structure

    Hello, I would like to implement a EVDRE report with 3 nested column dimension like this: Entity1                    Entity1                    Entity1                    Entity2                    Entity2                    Entity2          ... 2010

  • Getting loging out :S

    When i log on skype after couple of seconds i get sgined out! Show's me "You have been signed out", what should i do? And i changed password too Solved! Go to Solution.