Mind blown $Obj saves to CSV drops domain, when using F8 it saves!

Welcome Forums General PowerShell Q&A Mind blown $Obj saves to CSV drops domain, when using F8 it saves!

Viewing 0 reply threads
  • Author
    Posts
    • #164713
      Participant
      Topics: 4
      Replies: 0
      Points: 49
      Rank: Member

      My mind is blown i can not get this working.

      I am creating an Object

       $obj = [pscustomobject]@{ Domain = $domain; 
      IPAdress = $ipaddress; 
      PacketsLostPercentage = $packetslossed_percentage; 
      Average=$average}

      It is filled with the correct information. Selecting the $Obj and hitting F8 in ISE shows this:

      Domain                                  IPAdress         PacketsLostPercentage    Average
      tenant.sharepoint.com      13.107.136.9      0                                         5.14

      It then gets writting to a csv file with a function:

      write-to-csv $obj

      When i test it there the information is still in the Object. All of type String.

      In my function i do this:

      $Obj | Export-Csv -Path $working_path\$csvFileName -Append -NoTypeInformation

      And everything gets writtin corectly to the csv file exept the domain tenant.sharepoint.com

      And now for the kicker: If i select the line above and hit F8, all the information is still in the object and it gets writtin to the file, including the domain! I am at a loss. Please help.

       

      Thanks

       

       

       

       

       

Viewing 0 reply threads
  • The topic ‘Mind blown $Obj saves to CSV drops domain, when using F8 it saves!’ is closed to new replies.