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

  • Home
  • SEARCH
  • 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 4599938
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T23:36:46+00:00 2026-05-21T23:36:46+00:00

This can be applied to many different scenarios, but specifically I am running: Import-Csv

  • 0

This can be applied to many different scenarios, but specifically I am running:

Import-Csv "file.txt" | foreach { $_ }

Generically, the output is:

Attribute1 : $true
Attribute2 : asdf
Attribute3 : {}
Attribute4 : $true

How could I run a foreach loop that I could use to compare each attribute’s name and value? For example see which attribute’s equal $true but isn’t Attribute4. (I’m open to using something other than foreach, that’s just all I know.)

I realize that I could do (Import-Csv "file.txt").Attribute1, but I that would be very impractical do this for every attribute.

These attributes will be different types of variables (some strings, some booleans, some arrays) but I’ll go one question at a time.

EDIT :
I don’t think it’s relevant, but the CSV file came from
Get-ActiveSyncMailboxPolicy -Identity "Policy" | Export-Csv

  • 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-21T23:36:47+00:00Added an answer on May 21, 2026 at 11:36 pm

    Soemthing like this?

     Import-Csv "file.txt" | foreach-object { 
     $_.psobject.properties | where-object {
     $_.value -eq $true -and $_.name -ne "Attribute4}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This can be applied to many different languages, but I am specifically working with
I am asking this for Ruby, but I guess this principle can be applied
I've been working with S#arp Architecture but this can probably be applied to any
I don't think this can be done cleanly, but I'll ask anyway. I have
Ok, I know this has been asked many times, but my situation is a
This can be in any high-level language that is likely to be available on
This can be a good question for finding bugs. No? Okay for beginners at
Using this: Can I use Facebook's fb:friend-selector in an iframe? I created a multi-friend
I asked this Can I automate creating a .NET web application in IIS? a
I know this can be done and i have seen it done using some

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.