Get-ADUser SamAccount from CSV file does not work.

So I'm trying to get HomeDirectory + SamAccountName using Get-ADUser from an imported csv file called $csvFile
$GetUserInfo = Get-ADUser (Get-ADUser -Filter { displayName -eq $csvFile[$index].DisplayName}).SamAccountName -Properties SamAccountName,HomeDirectory
It gives me an error. 
Get-ADUser : Invalid type 'System.Object[]'.
Parameter name: displayName
At line:1 char:28
+ $GetInfoUser = Get-ADUser (Get-ADUser -Filter { displayName -eq $csvFile[5].Disp ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Get-ADUser], ArgumentException
+ FullyQualifiedErrorId : ActiveDirectoryCmdlet:System.ArgumentException,Microsoft.ActiveDirectory.Management.Commands.GetADUser
However if I do like this 
$DisplayName = $csvFile[$index].DisplayName
and replace $DisplayName to the filter like this, it works flawless and I get HomeDirectory and the SamAccountName
(Get-ADUser -Filter { displayName -eq $DisplayName }).SamA...
Any ideas or improvements

Still produces the same error. I'm running 4.0
How about this?
Import-Csv C:\Temp\user.csv | % {
$displayname = $_.displayname;
get-aduser -filter { displayname -eq $displayname } | Select SamAccountname , HomeDirectory
The below was my CSV format
DisplayName
Chendrayan Venkatesan
Ramesh Venkatesan
Regards Chen V [MCTS SharePoint 2010]

Similar Messages

  • Importing new users with plain text password using a csv file does not work

    Hello everyone,
    I am using csvde -i -f filename to import a number of users and their plain text passwords but it seems
    that the "Password" parameter in my csv file is not recognized.
    PS D:\csvfiles> csvde -i -f .\testimport.csv
    Connecting to "(null)"
    Logging in as current user using SSPI
    Importing directory from file ".\testimport.csv"
    Loading entries.
    Add error on line 2: No Such Attribute
    The server side error is "The parameter is incorrect."
    0 entries modified successfully.
    An error has occurred in the program
    No log files were written.  In order to generate a log file, please
    specify the log file path via the -j option.
    I'm probably doing something wrong but I can not see it. If you know what that is please let me know.
    Many thanks

    I suggested LDIFDE.exe or you can use the following PowerShell script to import your CSV file, if you have the Active Directory PowerShell Module installed:
    http://gallery.technet.microsoft.com/scriptcenter/ed20b349-9758-4c70-adc0-19c5acfcae45
    Enfo Zipper
    Christoffer Andersson – Principal Advisor
    http://blogs.chrisse.se - Directory Services Blog

  • Have tried many times to do mail merge from csv file but not working have watched all u tube vids!! Please help thank you

    I've downloaded Thunderbird and have imported all emails etc - works great!
    BUT when I try to do a mail merge it doesn't work! I've saved my excel file as cvs and understand that I need to use {{Email}} , {{First Name}} etc
    It just doesn't work for me - no emails in outbox or sent items?
    any ideas please?

    can you confirm a few things?
    You downloaded 'Mail Merge' and it is displayed in the Thunderbird 'Addon Manager' and it is enabled.
    Open the .csv file and checked that the info you are entering in the Write message eg: {{Email}} , {{First Name}} etc is the same as the column headers.
    example:
    {{FirstName}} OR {{First Name}}
    {{Email}} OR {{Primary Email}}
    you can edit the .csv file to change eg: {{Primary Email}} to {{Email}}
    you can also move the column headers, so that the first three columns show : First Name, Last Name, Email

  • I keep getting the message This XML file does not appear to have any style information axxociated with it. The document tree is shown below Is this a serious problem?

    My daughter and i use same computer she uses firefox and recently we have noticed on facebook apps we get the message This XML file does not appear to have any style information axxociated with it. The document tree is shown below

    Clear the cache and the cookies from sites that cause problems.
    * "Clear the Cache": Tools > Options > Advanced > Network > Offline Storage (Cache): "Clear Now"
    * "Remove the Cookies" from sites causing problems: Tools > Options > Privacy > Cookies: "Show Cookies"
    Start Firefox in [[Safe Mode]] to check if one of the add-ons is causing the problem (switch to the DEFAULT theme: Tools > Add-ons > Appearance/Themes).
    * Don't make any changes on the Safe mode start window.
    See:
    * [[Troubleshooting extensions and themes]]

  • I have tried to reinstall CS3 extended student version to my new comuter from the dvd and also from the web download but it does not work - I get the information that the server does not work- why. How should I do?

    I have tried to reinstall CS3 extended student version to my new comuter from the dvd and also from the web download but it does not work - I get the information that the server does not work- why. How should I do?

    Well the error message is in Swedish but says: The installation program database is damaged. Please contact the Adobe support (which is a hard thing to do!!). I use Windows 7 Home Premium with service pack 1.
    Från: Mylenium 
    Skickat: den 29 december 2014 16:48
    Till: Tony Bohman
    Ämne:  I have tried to reinstall CS3 extended student version to my new comuter from the dvd and also from the web download but it does not work - I get the information that the server does not work- why. How should I do?
    I have tried to reinstall CS3 extended student version to my new comuter from the dvd and also from the web download but it does not work - I get the information that the server does not work- why. How should I do?
    created by Mylenium <https://forums.adobe.com/people/Mylenium>  in Downloading, Installing, Setting Up - View the full discussion <https://forums.adobe.com/message/7050595#7050595>

  • I get wireless connection but my internet does not work on my ipad 2

    I get wireless connection but my internet does not work on my ipad 2

    Some things to try first:
    1. Turn Off your iPad. Then turn Off (disconnect power cord for 30 seconds or longer) the wireless router & then back On. Now boot your iPad. Hopefully it will see the WiFi.
    2. Go to Settings>Wi-Fi and turn Off. Then while at Settings>Wi-Fi, turn back On and chose a Network.
    3. Change the channel on your wireless router (Auto or Channel 6 is best). Instructions at http://macintoshhowto.com/advanced/how-to-get-a-good-range-on-your-wireless-netw ork.html
    4. Go into your router security settings and change from WEP to WPA with AES.
    5.  Renew IP Address: (especially if you are droping internet connection)
        •    Launch Settings app
        •    Tap on Wi-Fi
        •    Tap on the blue arrow of the Wi-Fi network that you connect to from the list
        •    In the window that opens, tap on the Renew Lease button
    ~~~~~~~~~~~~~~~~~~~~~~~~~
    iOS 6 Wifi Problems/Fixes
    Fix For iOS 6 WiFi Problems?
    http://tabletcrunch.com/2012/09/27/fix-ios-6-wifi-problems/
    Did iOS 6 Screw Your Wi-Fi? Here’s How to Fix It
    http://gizmodo.com/5944761/does-ios-6-have-a-wi+fi-bug
    How To Fix Wi-Fi Connectivity Issue After Upgrading To iOS 6
    http://www.iphonehacks.com/2012/09/fix-wi-fi-connectivity-issue-after-upgrading- to-ios-6.html
    iOS 6 iPad 3 wi-fi "connection fix" for netgear router
    http://www.youtube.com/watch?v=XsWS4ha-dn0
    Apple's iOS 6 Wi-Fi problems
    http://www.zdnet.com/apples-ios-6-wi-fi-problems-linger-on-7000004799/
    ~~~~~~~~~~~~~~~~~~~~~~~
    Look at iOS Troubleshooting Wi-Fi networks and connections  http://support.apple.com/kb/TS1398
    iPad: Issues connecting to Wi-Fi networks  http://support.apple.com/kb/ts3304
    WiFi Connecting/Troubleshooting http://www.apple.com/support/ipad/wifi/
    How to Fix: My iPad Won't Connect to WiFi
    http://ipad.about.com/od/iPad_Troubleshooting/ss/How-To-Fix-My-Ipad-Wont-Connect -To-Wi-Fi.htm
    iOS: Connecting to the Internet http://support.apple.com/kb/HT1695
    iOS: Recommended settings for Wi-Fi routers and access points  http://support.apple.com/kb/HT4199
    How to Quickly Fix iPad 3 Wi-Fi Reception Problems
    http://osxdaily.com/2012/03/21/fix-new-ipad-3-wi-fi-reception-problems/
    iPad Wi-Fi Problems: Comprehensive List of Fixes
    http://appletoolbox.com/2010/04/ipad-wi-fi-problems-comprehensive-list-of-fixes/
    Fix iPad Wifi Connection and Signal Issues  http://www.youtube.com/watch?v=uwWtIG5jUxE
    Fix Slow WiFi Issue https://discussions.apple.com/thread/2398063?start=60&tstart=0
    How To Fix iPhone, iPad, iPod Touch Wi-Fi Connectivity Issue http://tinyurl.com/7nvxbmz
    Unable to Connect After iOS Update - saw this solution on another post.
    https://discussions.apple.com/thread/4010130
    Note - When troubleshooting wifi connection problems, don't hold your iPad by hand. There have been a few reports that holding the iPad by hand, seems to attenuate the wifi signal.
    ~~~~~~~~~~~~~~~
    If any of the above solutions work, please post back what solved your problem. It will help others with the same problem.
     Cheers, Tom

  • Redemption code from Photoshop Elements 12 purchased from Best Buy does not work 'Oops! This code doesn't seem to be active. Please contact the retailer you purchased the card from, or use a different code.'   I have an invoice and the pickup notice from

    Redemption code from Photoshop Elements 12 purchased from Best Buy does not work 'Oops! This code doesn't seem to be active. Please contact the retailer you purchased the card from, or use a different code.'   I have an invoice and the pickup notice from Best Buy.   What other information does Best Buy need?   What will they do?   Will I get a new box?   What happened to the days of just typing in a simple s/n?   

    Redemption Code Help
    http://helpx.adobe.com/x-productkb/global/redemption-code-help.html

  • Windows 7 Defrag from command line does not work

    We are running Windows 7 in a virtualized environment. When running windows defrag using schedule or from command line, it does not work. The command that I am executing as administrator is
    C:\Windows\system32>defrag /c
    Microsoft Disk Defragmenter
    Copyright (c) 2007 Microsoft Corp.
    It displays the above message and exits back to the command prompt. However if I run the command defrag C: it does work. Defragmenting from the GUI works as well as long as both the disks (C: and System Reserved) are selected and when I click on
    Defragment disks, works fine.
    I am concerned about defrag running from the task scheduler with the command "defrag /c" (auto scheduled using Configure Schedule... from Disk Defragmenter) does not work and the system never gets defragmented automatically.
    This happens only with some of the windows 7 VM's that we have.
    There are no entries in Event Log that point to the defrag (using task scheduler). Any ideas what may be going on?

    Hi,
    Could you defrag as below method:
    1. Open Disk Defragmenter by clicking the Start button. In the search box, type
    Disk Defragmenter, and then, in the list of results, click
    Disk Defragmenter.
    2.Under Current status, select the disk you want to defragment.
    3.To determine if the disk needs to be defragmented or not, click Analyze disk. Administrator permission required If you're prompted for an administrator password or confirmation, type the password or provide confirmation.
    Once Windows is finished analyzing the disk, you can check the percentage of fragmentation on the disk in the
    Last Run column. If the number is above 10%, you should defragment the disk.
    4.Click Defragment disk. Administrator permission required If you're prompted for an administrator password or confirmation, type the password or provide confirmation.
    For more information, please read this article:
    Ways to improve your computer's performance
    http://windows.microsoft.com/en-in/windows/improve-performance-defragmenting-hard-disk#1TC=windows-7
    Meanwhile, read this article:
    Defrag from the Command-Line for More Complete
    Control
    http://technet.microsoft.com/en-us/magazine/ff458356.aspx
    Karen Hu
    TechNet Community Support

  • The "always match my default message font" option in the Signature preferences from Mac Mail does not work if e-mail is received in other Mail Software. How can I make it work?

    The "always match my default message font" option in the Signature preferences from Mac Mail does not work if e-mail is received in other Mail Software. How can I make it work?

    I found this plugin which solved pretty much all of my mail font rendering problems.  It is designed for Lion, so don't know whether it will work but thought I would offer it up.
    http://noware-it.zxq.net/

  • HT1202 The manual mode to transfer music to my iTune from my iPhone does not work as described. When I click on Manually manage... it displays the warning message that all music on my iPhone will be erased and replaced by iTune music.

    The manual mode to transfer music to my iTune from my iPhone does not work as described. When I click on Manually manage... it displays the warning message that all music on my iPhone will be erased and replaced by iTune music.
    How can I transfer my music to a second computer iTune?
    Thanks,

    See this user tip
    Syncing iPhone to a "New" Computer or replacing a "crashed" Hard Drive

  • When a pdf file is opened in a tab, the automatic scroll function from the pad does not work in the other tabs, but only for the particular PDF tab.

    The scroll function from the pad/mouse does not work for the other tabs when a PDF file is opened.

    Hi NSHS,
    Have you checked to see if your PDF add-on is up to date? You should take a look at the [[Opening PDF files within Firefox]] Knowledge Base article. There is a lot of good information in there. You should try both of the suggested PDF add-ons to see if that fixes the issue.
    Hopefully this helps!

  • Swf file does not work from InDesign

    I am not sure if this is a Flash or InDesign question, so i will post on both..
    I am trying to embed an “animated” swf file (that was created in flash) into an InDesign layout and then export the InDesign layout to swf. in the resulting html file my navigation works ok but the swf file does not play “animate” when viewed in html or flash. It only shows up as a graphic. 
    I have tried exporting the ID file to xfl and bringing it into flash but then none of my animation works. What am I doing wrong?
    any help would be appreciated.
    thanks
    mattG

    You´re doing nothing wrong. SWF export of InDesign CS4 doesn´t support any media files. You can place videos, sounds and animations into indesign layout, but if you export to SWF, they won´t work in resulting SWF. They work in interactive PDF.
    And you can export your basic layout to Flash CS4 by using XFL export and import those media elements in Flash, but that may be quite a job. I have been strugled a lot with that method. My files used to go really messy when I open them in Flash.

  • Getting input from mouse-wheel: does not work under windows/IE

    Hi
    I have built an applet that extends JApplet. To it I have added a class that extends JPanel implements MouseListener, MouseWheelListener, MouseMotionListener.
    I collect input using the method
    public void mouseWheelMoved(MouseWheelEvent e){
    do stuff...
    I have build this on a mac and tested it in firefox and it works fine. But on xp/vista internet explorer, the applet does not respond to mousewheel input. On mac osx /safari it does not work either.
    Is there any solution to this problem?
    Best regards, Carlis.

    Just for luck, try setting the JPanel focusable.panel.setFocusable(true);If that doesn't make a difference, you need to post a [_Short, Self Contained, Compilable and Executable, Example Program (SSCCE)_|http://mindprod.com/jgloss/sscce.html] that clearly demonstrates your problem.
    db

  • Link from flash file/moving not working on a page

    I will apologize first for what maybe a very elementary
    questions. I was sent an swf file to add to a web page. I got the
    movie to run on some of the pages where I inserted it into a
    template and the template updated those pages. I think had to
    insert it into another page and the movie does not work there. Does
    this have something to do with the script in the script folder? A
    conflict of some sort?
    Also, I need to link the file a URL and putting <a
    href> brackets around it is not working. Does the link to the
    page have to embedded in the swf file?
    Thanks for any help on this.
    URL to see pages
    Movie working but no link:
    http://www.grantwrangler.com/advertise.html
    Movie not even showing up:
    http://www.grantwrangler.com/index.html

    > Also, I need to link the file a URL and putting <a
    href> brackets around it is
    > not working. Does the link to the page have to embedded
    in the swf file?
    wrapping an A HREF tag around a flash .swf object will not
    work.
    the link has to be "in" the swf, back when it was an FLA file
    in flash.
    Or- the .swf has to have actionscripting in it so that it
    will take a url as
    a parameter.
    On the flash not showing--
    Random observations from a quick look.
    There is no \ backslash in a web path or url.
    you can usually "get away with it" on a windows server, but
    it's incorrect
    and something to avoid.
    <!-- Dependencies -->
    <link type="text/css" rel="stylesheet"
    href="build\fonts\fonts.css">
    <!--<link type="text/css" rel="stylesheet"
    href="build\reset\reset.css">-->
    <script type="text/javascript"
    src="build\yahoo\yahoo.js"></script>
    <script type="text/javascript"
    src="build\dom\dom.js"></script>
    <script type="text/javascript"
    src="build\event\event.js"></script>
    <!-- Source file and calendar css -->
    <script type="text/javascript"
    src="build\calendar\calendar.js"></script>
    <link rel="stylesheet" type="text/css"
    href="build\calendar\assets\calendar.css" >
    The javascript call to show the flash file contains an
    absolute local path:
    'file:///Macintosh HD/Users/user/Documents/ Work/Nimble Press
    Ÿ/Grant
    Wrangler/Website/GW ADs/tiged
    The noscript tag uses an absolute local path:
    <param name="movie" value="file:///Macintosh
    HD/Users/user/Documents/
    Work/Nimble Press Ÿ/Grant Wrangler/Website/GW
    ADs/tiged.swf">
    <param name="quality" value="high">
    <embed src="file:///Macintosh HD/Users/user/Documents/
    Work/Nimble Press Ÿ/Grant Wrangler/Website/GW
    ADs/tiged.swf" quality="high"
    pluginspage="
    http://www.adobe.com
    it's also not a good idea to put things in a folder using a
    blank space, and
    whose name contains the word "ADs"
    Alan
    Adobe Community Expert, dreamweaver
    http://www.adobe.com/communities/experts/

  • 'GetInfo' file does not work!

    Hey Folks,
    I have a strange problem...
    I have just migrated on a PPC-G5 from an Intel processor Mac (I have used the migration assistant utility) and the 'GetInfo' file doesn't work. I cannot have access to any file informations.
    The most surprising thing is this problem happens under my account only. There is 2 account on the computer and the 'GetInfo' works fine when I am logged-in under the second account.
    Do some one have an idea?
    Thanks for your help,
    Arnaud

    The thing is I have migrated from a (slow) MacIntel to a (fast) PPC-G5, and not the opposite. The 'Get Info' file function does not work...
    The same rules apply. Migration Assistant migrates wholesale lots of elements of the operating system. You'll be finding a needle in a haystack trying to find the right thing that doesn't belong.
    Your best bet is to erase and install the operating system that came with the G5, and restore piecemeal the documents and applications which will run on a G5.
    A MacIntel should not be slow, unless you depend a lot on old PowerPC applications that require G5 or G4 power. MacIntels may require more RAM as well.
    Unfortunately the differences between CPUs are great enough that plugins and drivers simply don't transfer over well when done by the Migration Assistant.

Maybe you are looking for