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

How to remove the first line fron a file
Last Post 20 Aug 2008 10:06 PM by bsonposh. 7 Replies.
Printer Friendly
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
MaryKUser is Offline
New Member
New Member
Posts:31

--
20 Aug 2008 09:28 PM  

Hello,

 

I am using pwoershell to get the alias value of the mailboxes using the below one liner so I can use the file to move those mailboxes using a different powershell code. However, I am looking for a way to delete the first line of the output file that contains the alias header. does anyone know of to integrate this in the same command below?

get-mailbox

-ResultSize 150 | where{$_.servername -eq myservername } | select alias | Export-Csv c:\users.txt -NoTypeInformation

bsonposhUser is Offline
Basic Member
Basic Member
Posts:388

--
20 Aug 2008 09:33 PM  
using format-table alias -HideTableHeaders instead of select


get-mailbox -ResultSize 150 | where{$_.servername -eq myservername } | ft Alias -HideTableHeaders| Export-Csv c:\users.txt -NoTypeInformation

or you can just do this

get-mailbox -ResultSize 150 | where{$_.servername -eq myservername } | %{$_.alias} | Export-Csv c:\users.txt -NoTypeInformation
MaryKUser is Offline
New Member
New Member
Posts:31

--
20 Aug 2008 09:44 PM  

Thanks for the quick reply. Unfortunately neither one of them works. The first one output GUIDs and teh second one length

Length
7
8
8
7
5

 

bsonposhUser is Offline
Basic Member
Basic Member
Posts:388

--
20 Aug 2008 09:51 PM  
/shrug

That makes no sense. I assume it is a formating issue.

Does it work if directed to the console?
MaryKUser is Offline
New Member
New Member
Posts:31

--
20 Aug 2008 09:57 PM  

Odd! directed at the console it works like a charm. However, piped into a csv does not seems to work, at least for me...

MaryKUser is Offline
New Member
New Member
Posts:31

--
20 Aug 2008 10:00 PM  

out-file seems to work instead...

bsonposhUser is Offline
Basic Member
Basic Member
Posts:388

--
20 Aug 2008 10:06 PM  
I assume it is the deserialization that occurs with export-csv
bsonposhUser is Offline
Basic Member
Basic Member
Posts:388

--
20 Aug 2008 10:06 PM  
You have me curious... I am going to go poke around the code... will let you know if I find anything.
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