header
header Register : : Login header
header
divider
menuleft
menuright
submenu
left

[August 25th, 2008] Check the home page regarding PowerShell related news from a brand new sponsor: Idera

Removing Header from results
Last Post 21 Nov 2008 02:12 PM by Shay. 1 Replies.
Printer Friendly
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
trwagner1User is Offline
New Member
New Member
Posts:5
Avatar

--
21 Nov 2008 02:03 PM  
Sometimes code can speak more accurately than a person can explain.  ;)

Given this code:

$server = server900.ms.corpnet.net
$array1 = @()

$array1 = get-wmiobject win32_share -computer $server -Filter "type < '10'" | sort "name" | ForEach {
$_ | select name
}
$array1[-1]

Should be simple... correct?

Assume I have 10 shares (named sequencially) on this server:

DeptShare901
...
DeptShare910


Here's my displayed result:

name
----
DeptShare910


However, I don't want that.  I want my DISPLAYED results to be the share...no header or column separator:

Displayed results should be:

DeptShare910


Rather than someone answer this straight-away, I would like to try to solve this with help on my own... so I'm asking for help rathar than someone tell me exactly what's wrong.  After all, how am I going to learn?  ;)  Then, I can re-post and share what I did so that others can also learn.

Does this have to do with the select statement or how I'm displaying the data?  I've been googling the different parts of this simple script example but everything I've tried so far always returns the column header and separator.

Thanks
ShayUser is Offline
Basic Member
Basic Member
Posts:271
Avatar

--
21 Nov 2008 02:12 PM  
Don't pipe to select-object. Select-object creates a new object with the properties you've selected and displays them together with the property name as the header.
Shay Levy
Windows PowerShell MVP
http://blogs.microsoft.co.il/blogs/ScriptFanatic
You are not authorized to post a reply.

Active Forums 4.1
right
   
footer Sponsored by Quest Software • SAPIEN Technologies • ShellTools, LLC • Microsoft Windows Server 2008 footer
footer