Solved

showing in column problem

Posted on 2012-03-28
3
423 Views
Last Modified: 2012-04-02
hello,
I'm trying to get a list of computers from Active Directory and send it as email to some people.
with
Get-ADComputer -filter * -searchbase "ou=computers,dc=domain,dc=com" | foreach { $_.name }

I get the following result (in a column)
computer1
computer2

when I set this to a variable and get the output to the variable with
$list = Get-ADComputer -filter * -searchbase "ou=computers,dc=domain,dc=com" | foreach { $_.name }
write-host $list

I get the below result (in a row)
computer1 computer2

is there a way to show this as it's original state (in a column)
computer1
computer2


thank you
0
Comment
Question by:TAI-
  • 2
3 Comments
 

Accepted Solution

by:
TAI- earned 0 total points
Comment Utility
hello,
found out that I have to use out-string,
it seems to be working
0
 
LVL 9

Expert Comment

by:chrismerritt
Comment Utility
Out-String? can't say i've ever used that before.

I would do it like this:

$list = Get-ADComputer -filter * -searchbase "ou=computers,dc=domain,dc=com"
$list | Select Name

Open in new window


Should work anyways.
0
 

Author Closing Comment

by:TAI-
Comment Utility
outstring work perfectly in one row
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

The article will show you how you can maintain a simple logfile of all Startup and Shutdown events on Windows servers and desktops with PowerShell. The script can be easily adapted into doing more like gracefully silencing/updating your monitoring s…
This article will help you understand what HashTables are and how to use them in PowerShell.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now