Avatar of Software Squirrel
Software SquirrelFlag for United States of America

asked on 

PowerShell not showing info

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
Active DirectoryPowershellWindows 10AzureWindows Server 2012

Avatar of undefined
Last Comment
Software Squirrel
Avatar of Hayes Jupe
Hayes Jupe
Flag of Australia image

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 : {}
Avatar of Software Squirrel

ASKER

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>_
Get-ADUser -Filter {mail -like '<email address>'} -Properties * | fl 

Open in new window

Avatar of Hayes Jupe
Hayes Jupe
Flag of Australia image

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

import-module activeDirectory

Open in new window

Avatar of Software Squirrel

ASKER

@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 <...>
import-module activeDirectory -erroraction stop

Open in new window

my comment was to remove workid from 'fl workid'
Avatar of Software Squirrel

ASKER

David Johnson, CD 
Same after -erroraction stop
Avatar of Software Squirrel

ASKER

David Johnson, CD 
Removed | fl workID
Same
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

|
Avatar of Software Squirrel

ASKER

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

Avatar of Software Squirrel

ASKER

I am not getting errors, so maybe it's just a user issue not having access to AD. I will try another user account.
ASKER CERTIFIED SOLUTION
Avatar of David Johnson, CD
David Johnson, CD
Flag of Canada image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of Software Squirrel

ASKER

That worked
so then the filter  {mail -like 'emailaddress'} is not matching try -eq instead
Avatar of Software Squirrel

ASKER

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



it is not 'mail' but 'EmailAddress'
Avatar of Software Squirrel

ASKER

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

Avatar of Software Squirrel

ASKER

Only one with results was
Get-ADUser -Filter *  -Properties * | Select Name, SamAccountName, EmailAddress
Avatar of Software Squirrel

ASKER

I was able to get it with Get-ADUser -Filter {EmailAddress -eq "abc@email.com"} -Properties *
Avatar of Software Squirrel

ASKER

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.
Active Directory
Active Directory

Active Directory (AD) is a Microsoft brand for identity-related capabilities. In the on-premises world, Windows Server AD provides a set of identity capabilities and services, and is hugely popular (88% of Fortune 1000 and 95% of enterprises use AD). This topic includes all things Active Directory including DNS, Group Policy, DFS, troubleshooting, ADFS, and all other topics under the Microsoft AD and identity umbrella.

86K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo