We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you a podcast all about Citrix Workspace, moving to the cloud, and analytics & intelligence. Episode 2 coming soon!Listen Now

x

PowerShell not showing info

High Priority
119 Views
Last Modified: 2020-04-02
I ran this script. It contacts AD but does not respond with results. It just waits for another entry.

C:\Save> Get-ADUser -Filter {mail -like 'emailaddress'} -Properties * | fl workid
C:\Save> _

It looks like above
Comment
Watch Question

Hayes JupeIT Director
CERTIFIED EXPERT

Commented:
AD powershell module not installed on the machine your running it from?


i run the same and get (keep in mind that "workID" doesnt exist in my AD - i assume thats a custom property in yours.)

PS C:\Windows\system32> Get-ADUser -Filter {mail -like '<email address>'} -Properties * | fl workid


workid : {}
Software SquirrelEnterprise Solutions Architect

Author

Commented:
Yes, it is another property, but anyway, I don't even get that.  I just get nothing.  
It acts like I just inserted:
C:\Save> Get-ADUser
C:\Save>_
David Johnson, CDSimple Geek from the '70s
CERTIFIED EXPERT
Distinguished Expert 2019

Commented:
Get-ADUser -Filter {mail -like '<email address>'} -Properties * | fl 

Open in new window

Hayes JupeIT Director
CERTIFIED EXPERT

Commented:
still indicates that the AD powershell module either inst installed or isnt loaded.

import-module activeDirectory

Open in new window

Software SquirrelEnterprise Solutions Architect

Author

Commented:
@Hayes Jupe
C:\Save>import-module activeDirectory
C:\Save>PS C:\Windows\system32> Get-ADUser -Filter {mail -like '<email address>'} -Properties * | fl workid
C:\Save>_

Also, @David Johnson, Same result after adding <...>
David Johnson, CDSimple Geek from the '70s
CERTIFIED EXPERT
Distinguished Expert 2019

Commented:
import-module activeDirectory -erroraction stop

Open in new window

David Johnson, CDSimple Geek from the '70s
CERTIFIED EXPERT
Distinguished Expert 2019

Commented:
my comment was to remove workid from 'fl workid'
Software SquirrelEnterprise Solutions Architect

Author

Commented:
David Johnson, CD 
Same after -erroraction stop
Software SquirrelEnterprise Solutions Architect

Author

Commented:
David Johnson, CD 
Removed | fl workID
Same
David Johnson, CDSimple Geek from the '70s
CERTIFIED EXPERT
Distinguished Expert 2019

Commented:
then it means no objects were returned from your code.
Get-ADUser -Filter {EmailAddress -like "abc@def.com"} -Properties * | Select Name, SamAccountName, EmailAddress

Open in new window

|
Software SquirrelEnterprise Solutions Architect

Author

Commented:
The first time I run in PS, it pops up the window like its processing something and then goes away quickly (so, I cannot see what it is saying). Then back to the prompt

Software SquirrelEnterprise Solutions Architect

Author

Commented:
I am not getting errors, so maybe it's just a user issue not having access to AD. I will try another user account.
Simple Geek from the '70s
CERTIFIED EXPERT
Distinguished Expert 2019
Commented:
lets start with
Get-ADUser -Filter *  -Properties * | Select Name, SamAccountName, EmailAddress

Open in new window

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Software SquirrelEnterprise Solutions Architect

Author

Commented:
That worked
David Johnson, CDSimple Geek from the '70s
CERTIFIED EXPERT
Distinguished Expert 2019

Commented:
so then the filter  {mail -like 'emailaddress'} is not matching try -eq instead
Software SquirrelEnterprise Solutions Architect

Author

Commented:
Get-ADUser -Filter {mail -eq 'abc@email.com'} -Properties * | fl workid
same result , nothing
Removed | fl workid
same result, nothing



David Johnson, CDSimple Geek from the '70s
CERTIFIED EXPERT
Distinguished Expert 2019

Commented:
it is not 'mail' but 'EmailAddress'
Software SquirrelEnterprise Solutions Architect

Author

Commented:
I tried EmailAddress with both -like and -eq
I also removed | fl workid and just ended with -Properties *
Same result

Software SquirrelEnterprise Solutions Architect

Author

Commented:
Only one with results was
Get-ADUser -Filter *  -Properties * | Select Name, SamAccountName, EmailAddress
Software SquirrelEnterprise Solutions Architect

Author

Commented:
I was able to get it with Get-ADUser -Filter {EmailAddress -eq "abc@email.com"} -Properties *
Software SquirrelEnterprise Solutions Architect

Author

Commented:
David Johnson, CD   's solution helped me identify that the values I was searching are empty.  The query I originally had was right, but I did not get feedback from my query.
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.