Help working with CSV files

I have a CSV file with 3 columns
Jobtitles-----ADRole1----- AdRole2
title1---------Role1---------Role4
title2---------Role2---------Role5
title2---------Role3--------Role6
And i also have a list of Active Directory Users in other variable $users.
I need to get the AD users which jobtitle match the ones in the first column of the csv "jobtitles"
I do it like:
import-module activedirectory
$csv2= Import-Csv e:\mycsv.csv | Select-Object JobTitles
$Jobtitles = @()
foreach ($line in $csv2) {
$Jobtitles += $line.title
$users = foreach ($user in $result){
get-aduser $user.loginname -properties title, samaccountname
foreach ($User in $Users) {
if ($Jobtitles -contains $User.title) {
write-host $User.samaccountname $User.title
This works fine.
What i don't know how to do is reference the same row in the csv
For example if the user jobtitle matches title1, add the user to the AD group Role1 and Role4 (because it is in the same row as those roles)
Any idea?
thanks

In the second line in your script, the " | select-object jobTitles" causes only the data from the jobTitles column in the .CSV file to be included in the array of objects stored in the $csv2 variable. If you avoid doing that, then all of the data from the
.CSV file will be present in $CSV.
But I don't think the code as shown "works fine". In the first foreach statement, your code references a property called .title, whereas the only property in $csv would appear to be .jobTitles. But, if it had been coded correctly, this would be a wasted
step, as it seems only intended to create another array of "title" values, which you already have in $csv2.
then the second foreach processes data in an undefined array called $result.
With these issues, it is a little difficult to determine what actually happens in the following code.
I'd suggest you give it another try then copy/paste the complete code for us to comment on.
Al Dunbar -- remember to 'mark or propose as answer' or 'vote as helpful' as appropriate.

Similar Messages

  • Help: Working with .MOV files in FCP and forced to RENDER FOR EVERY EDIT

    I'm working with .MOV files from my digital camera in Final Cut Pro and every time I make a new edit, I have to render it in order to see it in the canvas.
    How do I make it so that I don't have to render every edit in order to see it?
    (I've worked with files straight from a DV camera, and editing went fine. I'm assuming it has to do with the .MOV files)

    DV Cameras are not the same thing as a Digital camera. Digital cameras offer video on a limited basis and it's usually highly compressed in a non-editing format such as MPEG-2 or similar. NLEs are made to work with video cameras, not still cameras which is why you're having trouble.
    That's not to say you can't edit video captured with a digital camera, but you need to know how to prep it for editing. Some digital cameras shoot at odd frame rates and they all use some form of compression that is not typically used in editing. This means that you'll likely need to convert your clips to an editable format first using Compressor.
    Andy

  • Working with CSV files in Numbers 09

    I'm able to import CSV files into Numbers '09 but the CSV file has multiple categories in each column. I want to SUM just one section and put the result in a summary chart but don't how to limit the SUM to just one of the groups in the column. The number of the rows is constantly changing with each import but the data that I want to use is always in column G. I would like to be able to just import the updated CSV file without having to manual select the cells I want to use each time. Any ideas? Thanks.

    If you took care to use the Numbers's vocabulary, things would be easier.
    You import datas upon vehicle 1 in table 1, not in sheet 1.
    If you really use the import feature, you will get a new table name each time so the formula would be different each time.
    The good practice would be to create a table with 11 columns for each vehicle.
    In every cell of column K (the 11th one), the formula would be:
    =IF(ISERROR(VLOOKUP("Total Price",$G$1:G2,1,0)),"",IF(OR(G="Total Price",ISBLANK(G),NOT(ISERROR(VLOOKUP("type",$G$1:G2,1,0)))),"",1))
    Then, import the CSV,
    copy the newly created table's contents and paste it in the table dedicated to the vehicle.
    Delete the table created during the import process.
    Doing that,
    the cell dedicated to vehicle 1 in "Vehicle Expense Summary" would be :
    =SUMIF(vehicle1 :: K,">0",vehicle1 :: G)
    the cell dedicated to vehicle 2 in "Vehicle Expense Summary" would be :
    =SUMIF(vehicle2 :: K,">0",vehicle2 :: G)
    Yvan KOENIG (VALLAURIS, France) mercredi 3 mars 2010 19:04:30

  • Can I get pages to work with .csv files?

    I'm trying to use the pages mail merge feature! I have data in a CSV file and I'm on a mac using Pages.
    This is what I've discovered so far;
    Pages needs a .Numbers file to pull data from for the mail merge feature. So I take my CSV file, open it with numbers, save it as a .Numbers file and then go back to Pages to use the mail merge feature, but I get an odd error message, so I must not be converting right (or something).
    The error reads as follows; "Please select a Numbers document that has one or more named header columns and one or more rows of data." The CSV file has 20 contacts in it, so I'm not sure what it's asking for exactly, because in the .Numbers file I have 20 rows with data.
    Does anyone have any suggestions? Or perhaps they could point me to a reference manual of sorts?
    Thanks for your time!
    S.o.t.S.

    Thanks Jerrold, here's what I have.
    This is the Numbers document
    This is the Pages sheet
    These are the "options" selected for merging and then I click merge...
    and then the output of just one.

  • OmniPortlet - Working with CSV files

    Is it possible to filter a CSV file based on a Page parameter? It doesn't seem to work in my tests.
    If not, does anyone know an effective way to convert CSV/XLS to XML in row/rowset format? Perhaps using a pre-buils stylesheet that converts Excel XML to Rowset/Row?
    Any feedback greatly appreciated...

    Hello Stephen,
    The current OmniPortlet does not make any filtering. You can send some parameters in the URL or to a Web Service method but in this case the filter is made by the 'data source provider' itself, not by OmniPortlet.
    We will introduce filtering -for all data sources- in the next release of the OmniPortlet. (next PDK)
    Regards
    Tugdual Grall

  • Working with CSV files -Powershell

    Hello all,
                 Here is a senario where am struck for past 2 days and i thought some one here can help.
    I am trying to get unique lines out of a csv file based on one particular column. Lets take a rough example , below is a sample csv i have pasted.. where i need to get only one last row from each category
    Problem
    Severity
    Category
    1
    Warning
    Event
    2
    critical
    Alert
    3
    Warning
    Alert
    4
    Warning
    Event
    5
    Warning
    Alert
    So the end result should have the complete row of problem 4&5 as that is the last appearing of unique data. Just to add an information that my csvhas 25 columns and as big as 11MB of data. Any thoughts would be greatly appreciated.
    S.Arun Prasath HP ARDE TEAM

    If I understand your scenario, this does the job...
    $testdata=import-csv 'c:\temp\test.csv'
    $categories=$testdata | Select Category -Unique
    foreach($cat in $categories){
    $testdata | Where-Object{$_.Category -eq $cat.Category} | Select -Last 1
    Result:
    Problem                                                  
    Severity                                                
    Category                                               
    4                                                        
    Warning                                                 
    Event                                                  
    5                                                        
    Warning                                                 
    Alert  
    Just a humble SysAdmin

  • Has anyone not working with .dv files had synchronization problems?

    Has anyone not working with .dv files had sound synchronization problems? I'm not exactly sure what the alternatives to DV are, but I think one of them is HD.
    The reason for asking this question is to help isolate the nature and cause of a very serious flaw in iMovie '11. In the original release of iMovie '11 (version 9.0) there was a small--but serious--synchronization problem. In the 9.01 there is a large synchronization problem. We know of one person who has not experienced the problem, and he is not working with DV files (media). So we want to find out if anyone who is using something other than .dv files is experiencing a lack of synchronization between sound and picture. Knowing the answer to this will help with figuring out where the cause lies. For the initial iMovie '11 release (9.0), you probably would not notice a problem unless you had very long event-clips, e.g., two hours long. Events get this long if you are transferring from analog 8 mm tapes. Even then, it would have to be in scenes in which the connection between event and sound is obvious, e.g., close ups of people talking. It isn't until the 9.01 release that most people would notice anything. All we need to do is establish one case of a synchronization problem in which the person is using something other than DV.
    Message was edited by: Paul Bullen

    Hopefully, the 9.0.2 release will make my question moot. Zyfert must have posted the announcement of the release just as I was formulating my question. Still, if you have information on the subject, it would be interesting to hear.

  • Working with Multiple Files in Workspace Layout

    If I was working with multiple files in the workspace layout, they each used to be available for selection from a tab.  Now I can either cascade the files horizontally or vertically - but not have them appear in a tab across the top of the workspace layout.
    Does anyone know how to set the workspace to present multiple files in tabs?  I have CS3.

    Tanya,
    This may not help, but the times when that happens to me is when I go too fast and some operations haven't finished. I then try to select a file that hasn't completed and the file I select is in the process of having the data updated. The worst is when it is trying to render as I am doing something.
    I hope this helps some.
    Mel

  • Send mails with csv file as an attachment through oracle(SQL SCripts / Stor

    Hello Everybody,
    I have recently come across a requirement in which I am supposed to send mails with csv file as an attachment through oracle(SQL SCripts / Stored Procedure) .
    The contents of the csv file are to be retreived from the Database as well as the content of the mail and to whom it needs to be sent has also to be picked up from the database.
    Can somebody suggest me with a suitable code for the same?
    Would be of great help..!!
    Thanks & Regards,
    - VR
    Edited by: user646716 on Dec 18, 2009 10:44 AM

    read below links
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:255615160805
    http://www.orafaq.com/wiki/Send_mail_from_PL/SQL#Send_mail_with_UTL_TCP_-withattachments
    How to send csv file as an attachment

  • Problem when load more swf files work with xml files into my movie

    hi ;
    I have one flash file & more of swf files which work with xml files .
    when I load one swf file into my flash file  and remove it and load anther one on the same movieclip in my flash file it load the old swf file.
    when i load one on movieclip and remove it and load anther swf  on anther movieclip the file doesn`t work  and stoped.
    when test my flash file to load and remove swf files without xml file it work fine but when repleaced the swf files with other work with xml files the problem hapend.
    thanks;

    YOu should trace the names of the files that are being targeted for loading to see if they agree with what you expect.  If you want help with the coding you will need to show the code that is relevant to your problem (not all of it)

  • Photoshop CS6 keeps freezing when I work with large files

    I've had problems with Photoshop CS6 freezing on me and giving me RAM and Scratch Disk alerts/warnings ever since I upgraded to Windows 8.  This usually only happens when I work with large files, however once I work with a large file, I can't seem to work with any file at all that day.  Today however I have received my first error in which Photoshop says that it has stopped working.  I thought that if I post this event info about the error, it might be of some help to someone to try to help me.  The log info is as follows:
    General info
    Faulting application name: Photoshop.exe, version: 13.1.2.0, time stamp: 0x50e86403
    Faulting module name: KERNELBASE.dll, version: 6.2.9200.16451, time stamp: 0x50988950
    Exception code: 0xe06d7363
    Fault offset: 0x00014b32
    Faulting process id: 0x1834
    Faulting application start time: 0x01ce6664ee6acc59
    Faulting application path: C:\Program Files (x86)\Adobe\Adobe Photoshop CS6\Photoshop.exe
    Faulting module path: C:\Windows\SYSTEM32\KERNELBASE.dll
    Report Id: 2e5de768-d259-11e2-be86-742f68828cd0
    Faulting package full name:
    Faulting package-relative application ID:
    I really hope to hear from someone soon, my job requires me to work with Photoshop every day and I run into errors and bugs almost constantly and all of the help I've received so far from people in my office doesn't seem to make much difference at all.  I'll be checking in regularly, so if you need any further details or need me to elaborate on anything, I should be able to get back to you fairly quickly.
    Thank you.

    Here you go Conroy.  These are probably a mess after various attempts at getting help.

  • Working with flat file as source in owb 10.2

    Hi,
    I am working with flat file as source . While validating the mapping i am getting the following error like
    " to specify a data file configure the mapping , add a node under ' Source data file', type in the file name
    and select the file location."
    Please give me the suggestion . It is very urgent.

    Hi Venkat,
    I tried the following stepts.
    1. in Design Center select your mapping and right click and select configure
    2. select sql loader data files and select create
    3. On right hand side data file Name : enter your source file name (ex : source.csv)
    4. click ok button.
    5. open mapping and validate.
    The mapping is validating. After validating I deployed the mapping. Up to this the mapping is working fine.
    But when I start the mapping, It has completed with errors.
    The error message is:
    Status
    Error Log
    RPE-01013: SQL Loader reported error condition, number 1.
    LRM-00112: multiple values not allowed for parameter 'control'
    Job Summary
    Updated : 2009-02-24 15:32:43.0 Job Final Status : Completed with errors Job Processed Count : 1 Job Error Count : 1 Job Warning Count : 0
    Please give me the suggestions.
    Thanks,
    Venkat

  • Working with .wmv files on my new Mac

    Hi everyone,
    I have some videos that I downloaded onto my older pc that I would like to use in iMovie. Does anyone know how I can edit and/or convert it into a format to use on my mac?
    Thanks,
    Karen

    You can use the shareware program ReelBean to convert your .wmv to an mpeg-4 file (I think it does this in the free mode, but if not a license is $15), and then import that iMovie.
    To view the .wmv files, you need the freeware Flip4Mac. I suspect you will need the components installed by Flip4Mac for ReelBean to work with wmv files - not sure, but it won't hurt to install it.
    Hope this helps...

  • Problems working with raw files

    just purchased elements 5 to work with raw files. have downloaded 4.2 and installed it into correct file and have moved existing raw 8 bit file to desktop. when i try to import raw files into elements it still wont let me. stating error or wrong file type or something. i am working with windows xp. and shooting with a nikon D80.

    [email protected] wrote in
    news:[email protected]:
    > Martin ... Not many Elements users here ... the Elements forum is
    > here:
    >
    >
    > That said ... check Elements' 'Help' menu for the ability to list the
    > verion of ACR installed, and any ability to "update" automatically.
    >
    > HTH :)
    >
    I don't think that ACR 4.2 will work with Elements 5.
    John Passaneau

  • Problems working with source files

    Just downloaded the new 1343 release. Really like the product. But ... working with source files in SQL Developer is my worst nightmare. When I open a source file either from SQL Worksheet or from File/Open menu my PC freezes for an extended period of time. CPU utilization shots up to 100% and stays this high until the tab is open. I am on Windows XPSP2. Help!!!.

    We have reproduced your issue. If I open a large plsql program from the main SQL developer window (File Open) option it opens in a second or less. If from within the SQL worksheet, i right click and do a file / open on a small file it open in a second or less. If I right click in the SQL worksheet and do a file/open of a larger plsql program it appears to hang SQL developer.
    We are looking into the issue.
    Thanks,
    Mike

Maybe you are looking for

  • Package and GUI problems

    I am new to GUIs and have been working on a project for quite some time now. My problem is that I have a program working perfectly fine when I compile and run it on JGrasp (it's a demo version using just jOptionPanes). I am amking the GUIs in Netbean

  • Must Restart Frequently in Order to Regain Lost Internet Access

    Ever since upgrading my iPhone 4 to 4.1, I'm frequently having to restart the iPhone, because of the inability to connect to the Internet (even though "Cellular Data" is definitely turned on). This is getting to be frustrating. Is anyone else having

  • Deleting old events

    I imported a lot of old events from Palm Desktop and want to delete everything more than a year old. But ical won't let me change the default for deleting old events from "more than 30 days" which is much too short a period for me. I am losing NEW ev

  • Page imposition?  Paginate?  HELP!

    I made a simple, half-page (8.5 x 5.5) booklet in InDesign CS3, exported it to PDF and took it to Staples (because I can get a discount there) but, it will not print correctly AT ALL. I don't know if it has anything to do with working with newer soft

  • My new 32gb iPhone 5 gets too hot during phone calls. Is this normal?

    My new 32gb iPhone 5 gets too hot during phone calls. Is this normal?