Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4556806
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T17:25:06+00:00 2026-05-21T17:25:06+00:00

I just don’t understand why this is happening. If I create two separate new

  • 0

I just don’t understand why this is happening. If I create two separate new PSObjects, they seem to affect each other. For example, with this code:

$o1 = new-object psobject
$o1 | add-member noteproperty abc 123

$o2 = new-object psobject
$o2 | add-member noteproperty def 456

write-output $o1
write-output $o2

I would expect to see output for both abc and def, yet I only get abc:

abc
---
123

If I use write-host instead, like this:

write-host $o1
write-host $o2

Then it shows output like this:

@{abc=123}
@{def=456}

So according to write-output, $o2 is null/empty, but write-host says that’s a lie.

What’s going on?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T17:25:07+00:00Added an answer on May 21, 2026 at 5:25 pm

    If you run the sample lines from the console, you will see no issue. If you run them all in a script you will see an issue. This is because Out-Default (which is at the end of every pipeline) bases its formatting decisions on the first object it sees. So you need to make sure that you are not output more than one object type. Or if you are, you need to create some formatting rules that handle all the object types (like what is done for directory and file output from Get-ChildItem).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i just don't understand how to perform a FFT on two polynomials such as
I just don't seem to be able to figure this out in my head.
I just don't understand how this is done. I've gone through several questions here
I've seen this twice now, and I just don't understand it. When calculating a
Well, I just don't seem to understand certain things about RegExp . Can someone
intro: I am pretty sure this is my fault. But I just don't see
I keep reading about people who are test infected, meaning that they don't just
I don't know if anyone has seen this issue before but I'm just stumped.
I don't want to discuss the merits of this approach, just if it is
I just Don't understand how to use a boolean operator inside a switch statement

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.