Solved

showing in column problem

Posted on 2012-03-28
3
426 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
ID: 37775374
hello,
found out that I have to use out-string,
it seems to be working
0
 
LVL 9

Expert Comment

by:chrismerritt
ID: 37779031
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-
ID: 37795238
outstring work perfectly in one row
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Are you one of those front-line IT Service Desk staff fielding calls, replying to emails, all-the-while working to resolve end-user technological nightmares? I am! That's why I have put together this brief overview of tools and techniques I use in o…
In this previous article (https://oddytee.wordpress.com/2016/05/05/provision-new-office-365-user-and-mailbox-from-exchange-hybrid-via-powershell/), we made basic license assignments to users in O365. When I say basic, the method is the simplest way …
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

863 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

20 Experts available now in Live!

Get 1:1 Help Now