Also, give a snippet of your csv if you don't mind. Just need to see if there are headers, and what the delimiter is.
Christopher Catlett Consultant | Detroit [MCTS_2013_small] Sogeti USA Office 248-876-9738 |Fax 877.406.9647 26957 Northwestern Highway, Suite 130, Southfield, MI 48033-8456 www.us.sogeti.com<http://www.us.sogeti.com/> From: listsad...@lists.myitforum.com [mailto:listsad...@lists.myitforum.com] On Behalf Of Catlett, Christopher Sent: Thursday, December 12, 2013 2:49 PM To: powershell@lists.myitforum.com Subject: RE: [powershell] thought this would be simple To understand what your doing, you have a csv with list of the display names you want to iterate against. You want to return a few values from AD for those users. Correct? Christopher Catlett Consultant | Detroit [MCTS_2013_small] Sogeti USA Office 248-876-9738 |Fax 877.406.9647 26957 Northwestern Highway, Suite 130, Southfield, MI 48033-8456 www.us.sogeti.com<http://www.us.sogeti.com/> From: listsad...@lists.myitforum.com<mailto:listsad...@lists.myitforum.com> [mailto:listsad...@lists.myitforum.com] On Behalf Of Heaton, Joseph@Wildlife Sent: Thursday, December 12, 2013 2:31 PM To: 'powershell@lists.myitforum.com' Subject: RE: [powershell] thought this would be simple Christopher, Related question. Trying to get some info out of Get-ADUser, by first importing a csv. The csv has one column, called Name. This column has the display name of users. Here's my command: Import-csv c:\scripts\Users.csv | ForEach {Get-ADUser -Identity $_.Name -SearchBase "top OU to start search" -SearchScope Subtree -Properties Name,Mail | Select Name,Mail |Export-CSV c:\scripts\reports\user_mail.csv -Notypeinformation When I run this, I get the following error: Get-ADUser : Parameter set cannot be resolved using the specified named parameters. At line:1 char:62 + Import-Csv c:\scripts\users.csv | ForEach {Get-ADUser <<<< -Filter * -Identity $_.Name -SearchBase "OU=Top OU to start search" -SearchScope Subtree -Properties Name,Mail} | select Name,Mail | Export-Csv c:\scripts\reports\user_mail.csv -NoTypeInformation + CategoryInfo : InvalidArgument: (:) [Get-ADUser], ParameterBindingException + FullyQualifiedErrorId : AmbiguousParameterSet,Microsoft.ActiveDirectory.Management.Commands.GetADUser If I run a direct command: Get-adUser -filter * -Searchbase "Top OU to start search" -Searchscope Subtree -Properties Name,Mail | Select Name,Mail | export-csv c:\scripts\reports\user_mail.csv -Notypeinformation That command works. So, I'm guessing it has something to do with the $_.Name, but I can't figure out what I'm doing wrong there. Any advice? I'm sure this is something very simple that I'm missing, but I can't for the life of me find it. Thanks, Joe Heaton Enterprise Server Support Information Technology Operations Branch Data and Technology Division CA Department of Fish and Wildlife 1807 13th Street, Suite 201 Sacramento, CA 95811 Desk: (916) 323-1284 From: listsad...@lists.myitforum.com<mailto:listsad...@lists.myitforum.com> [mailto:listsad...@lists.myitforum.com] On Behalf Of christopher.catl...@us.sogeti.com<mailto:christopher.catl...@us.sogeti.com> Sent: Wednesday, December 04, 2013 1:14 PM To: powershell@lists.myitforum.com<mailto:powershell@lists.myitforum.com> Subject: RE: [powershell] thought this would be simple No problem. The reason for that, is if it did read all properties by default it could get quite messy. As there are ~60 properties (more if you have extend schema for different things) Christopher Catlett Consultant | Detroit [MCTS_2013_small] Sogeti USA Office 248-876-9738 |Fax 877.406.9647 26957 Northwestern Highway, Suite 130, Southfield, MI 48033-8456 www.us.sogeti.com<http://www.us.sogeti.com/> From: listsad...@lists.myitforum.com<mailto:listsad...@lists.myitforum.com> [mailto:listsad...@lists.myitforum.com] On Behalf Of Heaton, Joseph@Wildlife Sent: Wednesday, December 04, 2013 3:14 PM To: 'powershell@lists.myitforum.com' Subject: RE: [powershell] thought this would be simple That did it, thanks :) Joe Heaton Enterprise Server Support CA Department of Fish and Wildlife 1807 13th Street, Suite 201 Sacramento, CA 95811 Desk: (916) 323-1284 From: listsad...@lists.myitforum.com<mailto:listsad...@lists.myitforum.com> [mailto:listsad...@lists.myitforum.com] On Behalf Of christopher.catl...@us.sogeti.com<mailto:christopher.catl...@us.sogeti.com> Sent: Wednesday, December 04, 2013 12:01 PM To: powershell@lists.myitforum.com<mailto:powershell@lists.myitforum.com> Subject: RE: [powershell] thought this would be simple Get-ADUser -Filter * -Searchbase "top OU that I want to search from" -Searchscope Subtree -Properties Surname,GivenName,Mail | select Surname,GivenName,Mail | export-csv c:\location -NoTypeInformation Christopher Catlett Consultant | Detroit [MCTS_2013_small] Sogeti USA Office 248-876-9738 |Fax 877.406.9647 26957 Northwestern Highway, Suite 130, Southfield, MI 48033-8456 www.us.sogeti.com<http://www.us.sogeti.com/> From: listsad...@lists.myitforum.com<mailto:listsad...@lists.myitforum.com> [mailto:listsad...@lists.myitforum.com] On Behalf Of Trevor Sullivan Sent: Wednesday, December 04, 2013 2:50 PM To: powershell@lists.myitforum.com<mailto:powershell@lists.myitforum.com> Subject: RE: [powershell] thought this would be simple Joe, Not all Active Directory object attributes are returned by default. You will need to use the -Properties parameter on Get-ADUser to specify which Active Directory attributes you want to include in the result. Cheers, Trevor Sullivan From: listsad...@lists.myitforum.com<mailto:listsad...@lists.myitforum.com> [mailto:listsad...@lists.myitforum.com] On Behalf Of Heaton, Joseph@Wildlife Sent: Wednesday, December 4, 2013 1:44 PM To: powershell@lists.myITforum.com<mailto:powershell@lists.myITforum.com> Subject: [powershell] thought this would be simple I need to create a simple, 3 column csv: Last Name, First Name, e-mail address Note: We are not running Exchange in-house anymore, so I can't get this through Exchange shell, which would be much, much simpler. I have to get the info directly from Active Directory. I've run the following command: Get-ADUser -Filter * -Searchbase "top OU that I want to search from" -Searchscope Subtree | select Surname,GivenName,Mail | export-csv c:\location -NoTypeInformation That only gives me the first and last name, not the Mail attribute. So, I removed the select section, and just had it output everything to the csv. There's no mail attribute, and there's only 10 attributes showing. How can I get to the mail attribute? Thanks, Joe Heaton Enterprise Server Support CA Department of Fish and Wildlife 1807 13th Street, Suite 201 Sacramento, CA 95811 Desk: (916) 323-1284 ================================================ Did you know you can also post and find answers on PowerShell in the forums? http://www.myitforum.com/forums/default.asp?catApp=1 ================================================ Did you know you can also post and find answers on PowerShell in the forums? http://www.myitforum.com/forums/default.asp?catApp=1 ================================================ Did you know you can also post and find answers on PowerShell in the forums? http://www.myitforum.com/forums/default.asp?catApp=1 ================================================ Did you know you can also post and find answers on PowerShell in the forums? http://www.myitforum.com/forums/default.asp?catApp=1 ================================================ Did you know you can also post and find answers on PowerShell in the forums? http://www.myitforum.com/forums/default.asp?catApp=1 ================================================ Did you know you can also post and find answers on PowerShell in the forums? http://www.myitforum.com/forums/default.asp?catApp=1 ================================================ Did you know you can also post and find answers on PowerShell in the forums? http://www.myitforum.com/forums/default.asp?catApp=1 ================================================ Did you know you can also post and find answers on PowerShell in the forums? http://www.myitforum.com/forums/default.asp?catApp=1
<<inline: image001.jpg>>