Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.


Go Back   Vista Forums > Misc Newsgroups > PowerShell

RB

Vista - Import-CSV Exchange Powershell:How to use ";"

Reply
 
03-25-2009   #1
Help20030303


 
 

Import-CSV Exchange Powershell:How to use ";"

Hi at all,

i want to create mailboxes with the import-csv command. But the columns are
separated with a semicolon (. How could i set a ";" as a -delimiter?

Kind regards

My System SpecsSystem Spec
03-25-2009   #2
Help20030303


 
 

Re: Import-CSV Exchange Powershell:How to use ";"

I thank all for the replies,
but one questio:

what to do if i could not replace the ; cause the import.csv have columns
with values which need a "," ???

Am i able to upgrade the powershell to ctp 2 without damaging my exchange
management shell??

Kind regards
My System SpecsSystem Spec
03-25-2009   #3
Josh Einstein


 
 

Re: Import-CSV Exchange Powershell:How to use ";"

This function should work ok in v1. Let me know if there's any problems.

function Import-Delimited([String]$Path,[Char]$Delimiter="`t",[Switch]$Wait)
{

$HeadersProcessed = $false

filter ProcessLine {

if ($HeadersProcessed) {

$Fields = @($_.Split($Delimiter) | %{ $_.Trim() })

$OutputObject = New-Object PSObject
for ($i = 0; $i -lt [Math]::Min($Headers.Length,$Fields.Length);
$i++) {
Add-Member -InputObject $OutputObject NoteProperty
$Headers[$i] $Fields[$i]
}
$OutputObject

}
else {
$Headers = @($_.Split($Delimiter) | %{ $_.Trim() })
$HeadersProcessed = $true
}
}

if ($Wait) { Get-Content $Path -Wait | ProcessLine }
else { Get-Content $Path | ProcessLine }

}


"Help20030303" <Help20030303@xxxxxx> wrote in message
news:98869451-4FC5-404E-A39C-B859B56539E8@xxxxxx
Quote:

> I thank all for the replies,
> but one questio:
>
> what to do if i could not replace the ; cause the import.csv have columns
> with values which need a "," ???
>
> Am i able to upgrade the powershell to ctp 2 without damaging my exchange
> management shell??
>
> Kind regards
My System SpecsSystem Spec
03-27-2009   #4
Joel Bennett


 
 

Re: Import-CSV Exchange Powershell:How to use ";"

I wouldn't upgrade to CTP on a production Exchange server ... but as far
as I know there haven't been any known compatibility glitches.

There's a Import-Delimited script with a Convert-Delimiter function on
PoshCode that you could use, it should handle virtually any use case...
http://poshcode.org/search/delimiter
--
Joel



Help20030303 wrote:
Quote:

> I thank all for the replies,
> but one questio:
>
> what to do if i could not replace the ; cause the import.csv have columns
> with values which need a "," ???
>
> Am i able to upgrade the powershell to ctp 2 without damaging my exchange
> management shell??
>
> Kind regards
My System SpecsSystem Spec
Reply

RB


Thread Tools


Similar Threads for: Import-CSV Exchange Powershell:How to use ";"
Thread Forum
RE: SBS 2008 - "Exchange E-Mail address policy cannot be configured"... SBS Server
"exchange server must support auto-detect for the phone" SBS Server
"unknow exception" when trying to create exchange 2003 mailbox. VB Script
Can't find "import" or "export" on Windows Contacts toolbar Vista mail
Exchange 2007 "Activate the PowerShell" One liner Contest PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd