Import-CSV and PSObject

Hello,
I have a problem to get below approach.
Imagine that I have csv file with content as below:
Head1;Head2;Head3;
xyz;---;---;
---;zyx;---;
---;---;xzy;
123;---;---;
---;213;---;
---;---;321;
I'd like to import this file to powershell (import-csv) and put whole content to PSObject that:
1. First line contains only headers - that if I put $PSObj[1] I'll get all headers
2. All three "letters lines" are joined to one PSObject item - that if I put "$PSObj[1]" I'll get all these 3 lines
3. All three "numbers lines" are joined to one PSObject item - that if I put "$PSObj[2]" I'll get all these 3 lines
I need points 2 and 3 because I need to compare imported information on subject level (Test1 or Test2) and not to compare information on each line level.
One facilitation (I hope) is that each PSObject item begines when in a row in first column is not "---" value. And end of this item is one row before a row where in first colum is different value than "---" (it is shown on above example)
Has anyone an idea how to do it?

Hi D'Thompson,
Yes you are right, I think that to accomplish my idea I need to divide csv lines/items into separate objects as below:
Object 1 (5 items)
Head1 : TestName1
Head2 : ---
Head3 : ---
Head4 : ---
Head5 : Generic
Head6 : 1/8/2015 2:48:06 PM
Head7 :
Head1 : ---
Head2 : ---
Head3 : CommonDeploymentUtility
Head4 : 6.4.0.4025
Head5 : ---
Head6 : ---
Head7 :
Head1 : ---
Head2 : ---
Head3 : CommonUtility
Head4 : 6.4.0.4025
Head5 : ---
Head6 : ---
Head7 :
Head1 : ---
Head2 : ---
Head3 : Ionic
Head4 : 1.9.1.5
Head5 : ---
Head6 : ---
Head7 :
Head1 : llllllllll
Head2 : llllllllll
Head3 : llllllllll
Head4 : llllllllll
Head5 : llllllllll
Head6 : llllllllll
Head7 : llllllllll
Object 2 (9 items)
Head1 : TestName2
Head2 : ---
Head3 : ---
Head4 : ---
Head5 : Generic
Head6 : 6/17/2013 9:04:22 AM
Head7 :
Head1 : ---
Head2 : Experiences.PublishingExperiences
Head3 : ---
Head4 : ---
Head5 : ---
Head6 : ---
Head7 :
Head1 : ---
Head2 : ---
Head3 : Experiences.ListDefinitions.ExperienceLists
Head4 : 1.0.0.0
Head5 : ---
Head6 : ---
Head7 :
Head1 : ---
Head2 : Material.News
Head3 : ---
Head4 : ---
Head5 : ---
Head6 : ---
Head7 :
Head1 : ---
Head2 : ---
Head3 : Material.News
Head4 : 1.0.0.0
Head5 : ---
Head6 : ---
Head7 :
Head1 : ---
Head2 : Material.PublishingMaterials
Head3 : ---
Head4 : ---
Head5 : ---
Head6 : ---
Head7 :
Head1 : ---
Head2 : ---
Head3 : Material
Head4 : 1.0.0.0
Head5 : ---
Head6 : ---
Head7 :
Head1 : ---
Head2 : Material.Search
Head3 : ---
Head4 : ---
Head5 : ---
Head6 : ---
Head7 :
Head1 : llllllllll
Head2 : llllllllll
Head3 : llllllllll
Head4 : llllllllll
Head5 : llllllllll
Head6 : llllllllll
Head7 : llllllllll
So all I need is code that import csv file and divide content to many objects according to below rules
Beginning (first item) of an object is csv item where first column/position (Head1) value is not like "---" and not like "llllllllll".
Last item of such object would be csv item where first column/position (Head1) value is "llllllllll"
The code should also be able to create many PSObjects (as variables) with unique names (e.g. $PSObj1, $PSObj2, PSObj3,...).

Similar Messages

  • Need to import csv and manipulate one column

    I have a monthly report output by an FTP program into CSV format. The CSV file has headers and 3 columns:
    1) a group name
    2) the number of transfers that group made
    3) the total size of all their transfers (in bytes)
    Example (with headers and 6 rows of data for 7 rows total):
    "monthly transfers","sum of monthly transfers","sum of file size"
    "group1 (Prod to Dev)","26","11556381672"
    "group2 (Prod to Dev)","5","348197396"
    "group3 (Prod to Dev)","14","1272913379"
    "group1 (Dev to Prod)","0","0"
    "group2 (Dev to Prod)","1976","2036311426"
    "group3 (Dev to Prod)","1","131"
    I have been asked to write a script that will convert the bytes to megabytes and then sort based on group name and export the new data so auditors (non-technical people) can review it.
    I've worked with Excel a bunch in Powershell (I.E. opening a com object and writing directly to a cell) and I'd prefer to do it that way, but the server this script needs to run on doesn't have MS Office installed and can't have anything else installed on
    it, so I'm trying to learn about import-csv and such. I've come up with this:
    $file = "C:\ftp\ftp_report.csv"
    $csv = import-csv $file
    $csv | sort "monthly transfers"
    The part I'm stuck on is converting that third column from bytes to megabytes. I know that in Powershell I can do "X / 1mb" to convert a number from bytes to megabytes, but I'm not sure of how best to do this in a specific column of a CSV file.
    Should I create a hash table? Should I count the number of rows and then do a "foreach" on
    $csv[0].'sum of file size' / 1mb
    Am I overthinking this and there's a really easy way to manipulate all values in a column?
    Thank you in advance.
    [email protected]

    Probably like this, right at the parameter:
    ("{0:N2}" -f ($row.'sum of file size' / 1mb))
    There's no place like 127.0.0.1

  • Import-CSV and Takeown.

    I'm currently trying to come up with a way to search an entire folder directory to find all objects that a particular user is owner to, export that list to csv, then import that csv and using takeown to grant local Administrators Owner.
    Scouring the internet, I've been able to come up with this Powershell script to scan a directory and export the findings to a csv.
    param(
    [string]$username = "NameofUserSearchingFor",
    [string]$logfile
    Set-ExecutionPolicy Unrestricted
    if ($logfile -eq "") {
    $logfile = "c:\" + $username + "-Owner.csv"
    Write-Host "Setting log file to $logfile"
    #Path to search in
    [String]$path = "c:\TestFolder"
    [String]$AD_username = "Domain\" + $username
    #check that we have a valid AD user
    if (!(Get-ADUser $AD_username)){
    Write-Host "ERROR: Not a valid AD User: $AD_username"
    Exit 0
    Write-Output "$username" | Out-File -FilePath $logfile
    $files = Get-ChildItem $path -Recurse
    ForEach ($file in $files)
    $f = Get-Acl $file.FullName
    if ($f.Owner -eq $AD_username)
    Write-Output $file.FullName | Out-File -FilePath $logfile -Append
    exit 0
    That script exports data in the form of:
    NameofUserSearchingFor
    C:\TestFolder\TestFolder1
    C:\TestFolder\TestFolder2
    C:\TestFolder\TestFolder1\test1.txt
    C:\TestFolder\TestFolder2\test2.txt
    I'd like to use takeown to read each line of text and take ownership for local Administrators.  
    The script i'm trying to use doesn't do anything though.
    #Local Admininstrator Take Ownership
    $rows = Import-Csv "c:\NameofUserSearchingFor-Owner.csv"
    ForEach ($row in $rows)
    takeown /A /F $row
    Perhaps I'm going about this all wrong.  I'm relatively new to Powershell and have been trying to come up with a way to do this for the past 3 days.
    Any assistance would be greatly appreciated!
    *Update*
    If I reconfigure the takeown portion a bit to this:
    #Local Admininstrator Take Ownership
    $Path = "c:\NameofUserSearchingFor-Owner.csv"
    $rows = Import-Csv $Path
    ForEach ($line in $rows)
    takeown /A /F $Path
    The result is:
    SUCCESS: The file (or folder): "c:\NameofUserSearchingFor-Owner.csv" now owned by the administrators group.
    But will repeat as many times as there are lines of text in the csv.  So if there are 4 lines of text in the csv, that line will repeat 4 times.  I find it interesting that it knows how many lines there are but instead of granting local Administrator
    the owner to the path specified in the line it will instead grant local Administrator to the csv file.

    That is because you are takingownership of the CSV.
    ForEach ($line
    in$rows){
        takeown /A
    /F $Path
    should be:
    ForEach ($line
    in$rows){
        takeown /A
    /F $line
    ¯\_(ツ)_/¯

  • Import-csv and export-csv

     Hi everyone,
    How do I modify the script so that I see all the entries in the computers_result.csv file.  As it stands only the last entry in the computers.csv shoes up in the computers_result.csv file.  Thanks so much.
    Import-Csv C:\computers.csv | ForEach-Object {
    $computername = $_.computer
    $result = get-adcomputer $computername -Properties description  | select Name,Description
    $result | export-csv C:\computers_result.csv

    Try this and let me know
    $result = @()
    Import-Csv C:\computers.csv | ForEach-Object {
    $computername = $_.computer
    $result += get-adcomputer $computername -Properties description | select Name,Description
    $result | export-csv C:\computers_result.csv
    Regards Chen V [MCTS SharePoint 2010]

  • Import-csv and New-ADUser issue

    Hi there,
    I am fairly new to PS (and this site) and I don't understand what I am doing wrong. (I changed some domain settings where applicable to not the reflect the real-world scenario, just an example)
    CSV content:
    Firstname,Lastname,Maildomain,SAM,OU,Password,Description
    User,Test01,contoso.com,utest01,OU=Standard Users,OU=Users,DC=domain,DC=loc,P@ssw0rd,Test User
    PS script:
    $Users = Import-Csv -Delimiter "," -Path "C:\Userlist-sn.csv"
    foreach ($User in $Users)
    $Displayname = $User.Firstname + " " + $User.Lastname
    $UserFirstname = $User.Firstname
    $UserLastname = $User.Lastname
    $OU = "$User.OU"
    $SAM = $User.SAM
    $UPN = $User.Firstname + "." + $User.Lastname + "@" + $User.Maildomain
    $Description = $User.Description
    $Password = $User.Password
    New-ADUser -Name "$Displayname" -DisplayName "$Displayname" -SamAccountName $SAM -UserPrincipalName $UPN -GivenName "$UserFirstname" -Surname "$UserLastname" -Description "$Description" -AccountPassword (ConvertTo-SecureString $Password -AsPlainText -Force) -Enabled $true -Path "$OU" -ChangePasswordAtLogon $false –PasswordNeverExpires $true -server domain.loc
    I am getting the following error:
    New-ADUser : The object name has bad syntax
    At C:\Windows\System32\WindowsPowerShell\v1.0\import-test.ps1:12 char:15
    + New-ADUser <<<< -Name "$Displayname" -DisplayName "$Displayname" -SamAccountName $SAM -UserPrincipalName $UPN -GivenName "$UserFirstname" -Surname "$UserLastname" -Description "$Description" -AccountPassword (ConvertTo-SecureString $Password -AsPlainText -Force) -Enabled $true -Path "$OU" -ChangePasswordAtLogon $false –PasswordNeverExpires $true -server domain.loc
    + CategoryInfo : NotSpecified: (CN=User Test01...t Test User}.OU:String) [New-ADUser], ADException
    + FullyQualifiedErrorId : The object name has bad syntax,Microsoft.ActiveDirectory.Management.Commands.NewADUser
    Now that I am writing this question it kind of dawned on me whether or not the problem is with the csv, as delimiter is "," and the OU value has commas in it and it destroys syntax. If this is so then my question would be, how to save the input
    so the values are retained correctly? Is the New-ADUser command itself ok?
    Thank you all.

    Hi,
    Now that I am writing this question it kind of dawned on me whether or not the problem is with the csv, as delimiter is "," and the OU value has commas in it and it destroys syntax.
    Are the OUs quoted inside of the CSV? If so, the commas inside should be fine.
    Here's an easy test to see if your problem is with the input:
    Quoted OU path:
    PS C:\Scripts\PowerShell Scripts\Misc Testing\5-21-2014> Import-Csv .\Userlist-sn.csv
    Firstname : User
    Lastname : Test01
    Maildomain : contoso.com
    SAM : utest01
    OU : OU=Standard Users,OU=Users,DC=domain,DC=loc
    Password : P@ssw0rd
    Description : Test User
    Unquoted OU Path:
    PS C:\Scripts\PowerShell Scripts\Misc Testing\5-21-2014> Import-Csv .\Userlist-sn2.csv
    Firstname : User
    Lastname : Test01
    Maildomain : contoso.com
    SAM : utest01
    OU : OU=Standard Users
    Password : OU=Users
    Description : DC=domain
    Don't retire TechNet! -
    (Don't give up yet - 12,830+ strong and growing)

  • Import CSV data to an existing populated XLS file

    Hi Guys,
    Looking for some assistance, with some powershell I have never done before..  and don't know where to start..
    I have a CSV file that contains some data - Several items exported from a standard powershell command.
    I also have an XLS file that has been manually populated for the last 6 months with data.
    What I want to get to (and have started with exporting the data to csv) is for the script to run, and add the data from the CSV to the XLS in the already exisiting colum heading.
    SO in the first row - we need to add the date, followed by adding data under each subsequent column that already has a heading..
    Anyone got any suggestions on where to start with this? Any advice greatly appreciated.
    Thanks
    Allan Harding

    I think your question is a bit too broad and vague.
    If you are not a scripter then I recommend asking in the Exxcel forum.  THey will help you learn how to use Excel tomerge data tables.
    If you want to scrpt this then youneed to start by learning how to write a script.  YOu will want to use Import-Csv and the Excel object model.
    If this is critical then I recommend contacting a consultant.
    http://technet.microsoft.com/en-us/scriptcenter/dd742419.aspx
    ¯\_(ツ)_/¯

  • Data import XML and CSV

    Hi,
    I have customized incident form and added few fields as per our requirement.
    All customized fields are in a separate class extension "ClassExtension_9cd2b3e6_25ea_4385_9a94_fc08e0cf6172"
    Now we are planing to import incident data from our legacy ticketing tool (Manageengine Servicedesk).
    Here is my XML code 
    <CSVImportFormat>
    <Projection Type="System.WorkItem.Incident.ProjectionType">
    <Seed>
    <Class Type="ClassExtension_9cd2b3e6_25ea_4385_9a94_fc08e0cf6172">
    <Property ID="Id"/>
    <Property ID="Source"/>
    <Property ID="TierQueue"/>
    <Property ID="Classification"/>
    <Property ID="Title"/>
    <Property ID="Urgency"/>
    <Property ID="Impact"/>
    <Property ID="Description"/>
    <Property ID="Priority"/>
    <Property ID="Status"/>
    <Property ID="CreatedDate"/>
    <Property ID="ActualEndDate"/>
    <Property ID="ClosedDate"/>
    <Property ID="ResolutionDescription"/>
    <Property ID="Prod" />
    <Property ID="ParentAccount" />
    <Property ID="CustomerSupportAccount" />
    <Property ID="Hardware" />
    <Property ID="OperatingSystem" />
    <Property ID="Browser" />
    <Property ID="InternetConnection" />
    <Property ID="ProblemAffectsOthers" />
    <Property ID="SalesforceCase" />
    <Property ID="TFS" />
    <Property ID="CustomerSupportAgent" />
    </Class>
    </Seed>
    <Component Alias="AffectedUser" Count="1">
    <Seed>
    <Class Type="System.Domain.User">
    <Property ID="UserName" />
    <Property ID="Domain" />
    </Class>
    </Seed>
    </Component>
    <Component Alias="AssignedUser" Count="1">
    <Seed>
    <Class Type="System.Domain.User">
    <Property ID="UserName" />
    <Property ID="Domain" />
    </Class>
    </Seed>
    </Component>
    </Projection>
    </CSVImportFormat>
    I am getting below error while importing CSV
    Could not import the row on line 2 of CSV file C:\Users\administrator.TEST\Desktop\New folder (2)\New folder\Incident1.csv. It contains too few fields (number of fields expected 29 , found: 27).
    Could not import the row on line 3 of CSV file C:\Users\administrator.TEST\Desktop\New folder (2)\New folder\Incident1.csv. It contains too few fields (number of fields expected 29 , found: 27).
    Could not import the row on line 4 of CSV file C:\Users\administrator.TEST\Desktop\New folder (2)\New folder\Incident1.csv. It contains too few fields (number of fields expected 29 , found: 27).
    Could not import the row on line 5 of CSV file C:\Users\administrator.TEST\Desktop\New folder (2)\New folder\Incident1.csv. It contains too few fields (number of fields expected 29 , found: 27).
    Could not import the row on line 6 of CSV file C:\Users\administrator.TEST\Desktop\New folder (2)\New folder\Incident1.csv. It contains too few fields (number of fields expected 29 , found: 27).
    Could not import the row on line 7 of CSV file C:\Users\administrator.TEST\Desktop\New folder (2)\New folder\Incident1.csv. It contains too few fields (number of fields expected 29 , found: 27).
    Could not import the row on line 8 of CSV file C:\Users\administrator.TEST\Desktop\New folder (2)\New folder\Incident1.csv. It contains too few fields (number of fields expected 29 , found: 27).
    Could not import the row on line 9 of CSV file C:\Users\administrator.TEST\Desktop\New folder (2)\New folder\Incident1.csv. It contains too few fields (number of fields expected 29 , found: 27).
    Could not import the row on line 10 of CSV file C:\Users\administrator.TEST\Desktop\New folder (2)\New folder\Incident1.csv. It contains too few fields (number of fields expected 29 , found: 27).
    Could not import the row on line 11 of CSV file C:\Users\administrator.TEST\Desktop\New folder (2)\New folder\Incident1.csv. It contains too few fields (number of fields expected 29 , found: 27).
    Could not import the row on line 12 of CSV file C:\Users\administrator.TEST\Desktop\New folder (2)\New folder\Incident1.csv. It contains too few fields (number of fields expected 29 , found: 27).
    Could not import the row on line 13 of CSV file C:\Users\administrator.TEST\Desktop\New folder (2)\New folder\Incident1.csv. It contains too few fields (number of fields expected 29 , found: 27).
    CSV Import Summary Statistics for file C:\Users\administrator.TEST\Desktop\New folder (2)\New folder\Incident1.csv
    Instances created in memory: 0
    Instances failed in memory: 12
    Instances committed to database: 0
    Instances rejected by database: 0
    Note:I have 27 Fields in my CSV file.
    Regards, H@ri

    Thanks Andreas,
    I have made changes as suggested by you.But i am getting below error while importing the data.
    ============
    Creating new CSVImporter 
    Data Filename: C:\Users\administrator.TEST\Desktop\New folder (2)\New folder\Incident1.csv
    Format Filename: C:\Users\administrator.TEST\Desktop\Incident1.xml
    Validating against XSD schema...
    Validation completed.
    Warning: possible error in row on line 1 of CSV file C:\Users\administrator.TEST\Desktop\New folder (2)\New folder\Incident1.csv. The following message was logged:
    --> Could not find cached enumeration value Source for property Source, class System.WorkItem.Incident in enumeration cache. You must specify either the Name or Guid of an enumeration of type IncidentSourceEnum.
    Error: Could not import the row on line 1 of CSV file C:\Users\administrator.TEST\Desktop\New folder (2)\New folder\Incident1.csv. Object creation failed with the following error:
    --> Exception of type 'Microsoft.EnterpriseManagement.CSVImport.CSVInstanceException' was thrown.
    Warning: possible error in row on line 2 of CSV file C:\Users\administrator.TEST\Desktop\New folder (2)\New folder\Incident1.csv. The following message was logged:
    --> Matched enum value E-Mail for property Source of class System.WorkItem.Incident in data file with enum display name: E-Mail. Display names may not be unique. Consider using actual property name IncidentSourceEnum.Email.
    Warning: possible error in row on line 2 of CSV file C:\Users\administrator.TEST\Desktop\New folder (2)\New folder\Incident1.csv. The following message was logged:
    --> Matched enum value SaaS IT NOC for property TierQueue of class System.WorkItem.Incident in data file with enum display name: SaaS IT NOC. Display names may not be unique. Consider using actual property name Enum.e5d90c8dd3074cf2a241968f3d676cde.
    Warning: possible error in row on line 2 of CSV file C:\Users\administrator.TEST\Desktop\New folder (2)\New folder\Incident1.csv. The following message was logged:
    --> Matched enum value EMR for property Classification of class System.WorkItem.Incident in data file with enum display name: EMR. Display names may not be unique. Consider using actual property name Enum.f9c3dc992c584534b420b0fff7d3d426.
    Warning: possible error in row on line 2 of CSV file C:\Users\administrator.TEST\Desktop\New folder (2)\New folder\Incident1.csv. The following message was logged:
    --> Matched enum value Medium for property Urgency of class System.WorkItem.TroubleTicket in data file with enum display name: Medium. Display names may not be unique. Consider using actual property name System.WorkItem.TroubleTicket.UrgencyEnum.Medium.
    Warning: possible error in row on line 2 of CSV file C:\Users\administrator.TEST\Desktop\New folder (2)\New folder\Incident1.csv. The following message was logged:
    --> Matched enum value Medium for property Impact of class System.WorkItem.TroubleTicket in data file with enum display name: Medium. Display names may not be unique. Consider using actual property name System.WorkItem.TroubleTicket.ImpactEnum.Medium.
    Warning: possible error in row on line 2 of CSV file C:\Users\administrator.TEST\Desktop\New folder (2)\New folder\Incident1.csv. The following message was logged:
    --> Matched enum value Closed for property Status of class System.WorkItem.Incident in data file with enum display name: Closed. Display names may not be unique. Consider using actual property name IncidentStatusEnum.Closed.
    Warning: possible error in row on line 2 of CSV file C:\Users\administrator.TEST\Desktop\New folder (2)\New folder\Incident1.csv. The following message was logged:
    --> Could not find cached enumeration value Prod1 for property Prod, class ClassExtension_9cd2b3e6_25ea_4385_9a94_fc08e0cf6172 in enumeration cache. You must specify either the Name or Guid of an enumeration of type Prod.
    Error: Could not import the row on line 2 of CSV file C:\Users\administrator.TEST\Desktop\New folder (2)\New folder\Incident1.csv. Object creation failed with the following error:
    --> Exception of type 'Microsoft.EnterpriseManagement.CSVImport.CSVInstanceException' was thrown.
    =======================
    Regards, H@ri

  • Importing CSV file and parsing it

    First of all I am very new to writing powershell code.  Therefore, my question could be very rudimentary, but I cannot find an answer, so please help.
    I'm trying to read a CSV file and parse it.  I cannot figure out how to access nth element without hardcoding its name.
    $data = Import-Csv $file   #import CSV file
    # read column headers (manually read the first row of the data file, or import it from other source, or ...)
    $file_dump = Get-Content $file  #OK, I'm sure there is another way to get just the first line, but that's not relevant
    $name_list = $file_dump[0].split(",")
    # access element
    $temp = $data[$i].Name  # works - but that's HARDCODING the column name into the script - what if someone changes it?
    #but what I want to do is
    $temp = $data[$i].$name_list[0]
    How do I do this in PowerShell?

    So you're asking how to get the first data point from the first column, no matter what the header is?
    Why won't you know what your input file looks like?
    You can always drop the first line of the file to remove the existing headers and then use the -Header parameter of Import-Csv to give yourself known headers to reference (this will only work if you know how many columns to expect, etc etc etc).
    http://ss64.com/ps/import-csv.html
    Don't retire TechNet! -
    (Don't give up yet - 13,085+ strong and growing)

  • Import-csv consisting of permissions and users

    I have exported a csv via powershell and i am looking use that csv to import and edit some ad objects.  any assistance would be appreciated.  this is what i have cobbled together so far:
    Get-ReceiveConnector <RelayName> | import-csv c:\scripts\permissions.csv | % {Add-ADPermission –User $_.user –ExtendedRights $_.Permissions}
    TIA

    when i use your get-receiveconnector script my csv file looks like this:
    PSComputerName
    RunspaceId
    AccessRights
    ExtendedRights
    ChildObjectTypes
    InheritedObjectType
    Properties
    Deny
    InheritanceType
    User
    Identity
    IsInherited
    IsValid
    exchangereceive.com
    d767dfd3-b03d-4fa9-8c78-b38a80dda06c
    System.DirectoryServices.ActiveDirectoryRights[]
    Microsoft.Exchange.Configuration.Tasks.ExtendedRightIdParameter[]
    TRUE
    All
    DOMAIN1\ExchangeLegacyInterop
    exchangerecev\Default receive
    FALSE
    TRUE
    If i were to use your second script wouldnt it have to be modified so that the user that requires the rights is included?
    That is because it is a real CSV file.  It needs to be loaded with Import-Csv
    ¯\_(ツ)_/¯

  • Export AD users to csv and import them to Exchange using shell

    I'm implementing Exchange 2013 on a Windows server 2012R@ network.
    Now i want to import the users from the AD on the server into the Exchange server.
    I've created a csv from the AD users, but there begins the problem.
    I can't seem to get past some isseus..... The following script is where i'm at at the moment.
    C:\Windows\system32> $list=import-csv "C:\users......." |foreach {new-mailbox $_.emailaddresss}
    when i run this script in the shell of exchange i'm missing some parameters.
    I need a password and a userprincipalname.
    Can i include this in my script? And which password do i need?

    Are you implementing Exchange 2013 into an existing AD environment or are you trying to import users that exist in a separate AD forest into your environment?
    If you are implementing Exchange into an existing AD forest where the AD user accounts already exist, do use the Enable-Mailbox cmdlet instead as this adds a mailbox for an existing AD user.  The New-Mailbox cmlet will create a new AD user account,
    which would be a problem if the accounts already exist.
    If you are trying to bulk create mailboxes in a new AD environment where these AD accounts do not already exist, then you will need to create a password to assign to all the new accounts being created.
    This link has information on creating new mailboxes using an input CSV and assigning passwords via the EMS.
    http://exchangepedia.com/2006/11/exchange-server-2007-bulk-creation-of-mailboxes-using-exchange-management-shell.html

  • How do you import CSV, tab, and OFX files into multiple Numbers columns

    This Apple function from Numbers '08 Help "Importing a Document" does not seem to work:
    "You can create a new Numbers spreadsheet by importing a document created in Microsoft Excel or AppleWorks 6. Numbers can also import files in comma-separated value (CSV) format, tab-delimited format, and Open Financial Exchange (OFX) format."
    No amount of experimenting with Import, Export, Save As, Paste and Match Style, or using other applications will enable importing CSV, tab, or OFX files into multiple Numbers columns. Instead, all data is imported into a single Numbers column, which then has to be manually and tediously parsed one data element at a time into columns, one row, and one column at a time.

    Jerrold Green1 wrote:
    Joe,
    They all have worked here. I'm not presently able to try in Numbers 08, but I know I've done them all.
    Just double-clicking a .csv file will open Numbers and display the data in a table. Dragging a .csv file to your Numbers icon on the Dock will open it as a Numbers table. Dragging it to a Sheet in an open Numbers document will make a new table in an existing document, and dragging to a table will insert the csv file into the table you dropped it into.
    CAUTION
    With Numbers '08, CSV files must use the comma as delimiter on every setting of decimal separator.
    Numbers '09 behave differently.
    With your tab-delimited file open in a word processor, copy it, then paste it into a table in an open Numbers document. When doing this, select a cell in the table, but don't double-click into the text field of the cell, then paste.
    Why use this long road when we may import directly Tab Separated Values file (tsv.txt) with Numbers '08 (or '09) ?
    Yvan KOENIG (VALLAURIS, France) jeudi 2 décembre 2010 21:05:36

  • How do I import csv file into a SharePoint list?

    I am trying to use a PowerShell script to load data into a SharePoint list from a csv file. When I run my code, it seems to go through the process of loading the data into the list. However when I go to my list, all I see is "System.Object[]" displayed
    in the first column of all my rows with no other data displayed. When I check my csv file, I see a ton of data (several rows and columns) but that is not being moved to my SharePoint list. This is what my script looks like
    if((Get-PSSnapin | Where {$_.Name -eq “Microsoft.SharePoint.PowerShell”}) -eq $null) {
    Add-PSSnapin Microsoft.SharePoint.PowerShell
    $web = Get-SPWeb http://link to web
    $list = $web.lists["List Name"]
    $recordsNumber = 0
    foreach($i in Import-CSV myCSVFile.csv)
    $new = $list.Items.Add()
    $new["Title"] = $i.Title,
    $new["FirstName"] = $i.FirstName,
    $new["LastName"] = $i.LastName
    $new.Update()
    $recordsNumber++
    "Added " + $recordsNumber.ToString() + " records."
    "Done. Press any key to continue..."
    $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
    Any ideas on how to fix this, and get my list populated with data?

    if ( (Get-PSSnapin -Name Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue) -eq $null )
    Add-PsSnapin Microsoft.SharePoint.PowerShell
    $host.Runspace.ThreadOptions = "ReuseThread"
    #Open SharePoint List
    $SPServer=http://SOMESERVER
    $SPAppList="/Lists/List Name/"
    $spWeb = Get-SPWeb $SPServer
    $spData = $spWeb.GetList($SPAppList)
    $InvFile="myCSVFile.csv"
    # Get Data from Inventory CSV File
    $FileExists = (Test-Path $InvFile -PathType Leaf)
    if ($FileExists) {
    "Loading $InvFile for processing..."
    $tblData = Import-CSV $InvFile
    } else {
    "$InvFile not found - stopping import!"
    exit
    # Loop through Applications add each one to SharePoint
    "Uploading data to SharePoint...."
    foreach ($row in $tblData)
    "Adding entry for "+$row."Application Name".ToString()
    $spItem = $spData.AddItem()
    $spItem["Title"] = $row."Title".ToString()
    $spItem["FirstName"] = $row."FirstName".ToString()
    $spItem["LastName"] = $row."LastName".ToString()
    $spItem.Update()
    "Upload Complete"
    $spWeb.Dispose()
    Link
    Please 'propose as answer' if it helped you, also 'vote helpful' if you like this reply.

  • Excel issues with importing CSV or HTML table data from URL - Sharepoint? Office365?

    Greetings,
    We have a client who is having issues importing CSV or HTML table data as one would do using Excel's Web Query import from a reporting application.  As the error message provided by Excel is unhelpful I'm reaching out to anyone who can help us begin to
    troubleshoot problems affecting what is normal standard Excel functionality.  I'd attach the error screenshot, but I can't because my account is not verified....needless to say it says "Microsoft Excel cannot access  the file https://www.avantalytics.com/reporting_handler?func=wquery&format=csv&logid=XXXX&key=MD5
    Where XXXX is a number and MD5 is an md5 code.  The symptoms stated in the error message are:
    - the file name or path does not exist
    -The file is being used by another program
    -The workbook you are trying to save has the same name as a currently open workbook.
    None of these symptoms are the case, naturally. The user encountered this with Excel2010, she was then upgraded to Excel2013 and is still experiencing the same issue. The output of this URL in a browser (IE, Chrome, Firefox) is CSV data for the affected
    user, so it is not a network connectivity issue.  In our testing environment using both Excel2010 or 2013 this file is imported successfully, so we cannot replicate.  The main difference I can determine between our test environment and the end-user
    is they have a Sharepoint installation and appear to have Office365 as well.
    So,  my question might more appropriately be for Sharepoint or Office365 folks, but I can't be sure they're  a culprit.  Given this - does anyone have any knowledge of issues which might cause this with Sharepoint or Office365 integrated with
    Excel and/or have suggestions for getting more information from Excel or Windows other than this error message?  I've added the domain name as a trusted publisher in IE as I thought that might be the issue, but that hasn't solved anything.  As you
    can see its already https and there is no authentication or login - the md5 key is the authentication.  The certificate for the application endpoint is valid and registered via GoDaddy CA.
    I'm at a loss and would love some suggestions on things to check/try.
    Thanks  -Ross

    Hi Ross,
    >> In our testing environment using both Excel 2010 and 2013 this file is imported successfully, so we cannot replicate.
    I suspect it is caused by the difference of web server security settings.
    KB: Error message when you use Web query to a secure Web page (HTTPS://) in Excel: "Unable to open"
    Hope it will help.
    By the way, this forum is mainly for discussing questions about Office Development (VSTO, VBA and Apps for Office .etc.). For Office products feature specific questions, you could consider posting them on
    Office IT Pro forum or Microsoft Office Community.
    Regards,
    Jeffrey
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Help importing csv for birthday email campaign

    Hello,
    I've used the downloaded data template and uploaded a list of customers. My list shows 153 customers. After I upload it, the name of the list has (84) after it, and when I hover over the name and hit "View Subscribers," it shows 94 items in the list, (at the bottom right of the list, as such: Displaying page 1 of 5, items 1 to 20 of 94).
    When I import the csv, through the E-Mail Campaigns > Recipients window, I get a window with the following:
    Have you downloaded and reviewed the import template file (above right) to ensure your import file is setup correctly? More than one column in your customer database is updated during this import.
    I don't understand what the second sentence means. I've used the template and copied my records into it.
    Comparing lists, it is skipping names, and I can't find anything triggering it. The records are complete.
    Thanks in advance for any advice.
    Teresa

    Hi Vkid12,
    You can refer to the script below, which can check if the ad user exists, if not, it will create a new user and its phone:
    The input file c:\input.csv listed like:
    name, manager, email, location, phone
    nana, haha, [email protected], 123
    import-csv c:\input.csv|foreach{
    try{
    get-ADUser $_.name -ErrorAction Stop}
    catch{
    New-ADuser $_.name -OfficePhone $_.phone}
    To create user with the cmdlet New-ADUser, please refer to this article:
    http://technet.microsoft.com/en-us/library/ee617253.aspx
    If there is anything else regarding this issue, please feel free to post back.
    Best Regards,
    Anna Wang

  • Address Book -- Importing CSV File created by Numbers

    I'm trying to import a csv file generated from MS outlook into address book. When I attempt to import the csv file that Outlook created, Address Book is able to recognize the file. However, I need to modify the file before importing. To do that, I opened in Numbers, deleted some columns and renamed some columns. Then, I exported from Numbers as a .CSV file. However, when I try to import the .CSV file created by numbers, I get the error that I have modified with Numbers, I get the error "Text file import failure".
    Does anybody know why address book can't import a CSV file created by Numbers?

    Many people have run into this problem, including myself. I had worked many hours on a spreadsheet in Numbers, exported to CSV, and received the error message when trying to import into Address Book. The answers to this dilemma are out there, but tidbits of the whole answer are spread around discussion boards. So I hope to consolidate those answers here.
    The main problem for me -- and it's reasonable to assume that others receive the "Text File import error" for the same reason -- is that 1) I had commas in my spreadsheet, and 2) I had hidden RETURNs in the spreadsheet. Once I got rid of those two things, I had no problem importing into Address Book.
    Deleting Commas>
    The problem with commas in your spreadsheet is that the CSV format uses commas to distinguish when a new cell is formed. So having other commas will inevitably confuse Address Book during the attempted import. I didn't have too many commas in my spreadsheet, so I was able to quickly remove them. Yet, if you have dozens or hundreds of cells with commas in them, you'll need an easier solution. I imagine opening Number's Inspector>Cell Inspector>Format will have the solution of removing commas from, say, currency amounts or something else. Yet, how many commas arise in contact information? Perhaps the easiest way is to use the same method of removing those hidden RETURNs. Read on...
    Deleting Hidden RETURNs>
    You can't see them, and I couldn't find a "show invisibles" option in Numbers. So you need to search and find them. Yet, how do you search for something hidden? Do the Command-F thing to bring up the search field. The search bar should automatically be ready to search what you type. Hitting the Return key will do nothing for you, but hitting Shift-Option-Return will (you'll likely need to hit Return again to actually perform the search). Numbers will point out how many times these hidden returns are in your spreadsheet, which cells contain them, and give you the option to automatically replace them with something else (a space is a safe option). You can do the same search and replace with commas too.
    Save your spreadsheet, export it as CSV, and -- as long as the only errors stemmed from commas and hidden RETURNs -- you shouldn't have a problem having Address Book import it. Good luck!
    PS- After importing my spreadsheet, I noticed that some of my Smart Groups in Address Book were not showing some people who should have automatically been in there. The problem was that the Smart Group search had straight apostrophes in it, but the imported contact had curved apostrophes. The computer saw these as two unrelated characters. After some copying and pasting, the problem was solved.

Maybe you are looking for