Display the Results of Powershell Script

Display the Results of Powershell Script

I have this Powershell Script, but when I run it , I do not see the result displayed on the screen. How can I accomplish that ?
Thank you


$AllUserData = get-aduser -filter  * -SearchBase "CN= IS,DC=MyDomain,DC=com" -Properties *
$AllUserData | ft
$AllUserData | ft SAMAccountName, Name, WWWHomePage, Mobile
$AllUserData | where-object { $_.Name -like "*Jsmith*" }
jskfanAsked:
Who is Participating?
 
QlemoBatchelor, Developer and EE Topic AdvisorCommented:
You are running that inside of a PowerShell session, or use "Run with PowerShell" from Explorer?
The latter will not keep the console open.
The former should display something if there is something found. Check $AllUserData (by just typing that) - is it showing some data?
1
 
Alex Green3rd Line Server SupportCommented:
$AllUserData = get-aduser -filter  * -SearchBase "ou" -Properties *
$AllUserData | ft
$AllUserData | ft SAMAccountName, Name, WWWHomePage, Mobile
$AllUserData | where-object { $_.Name -like "*Jsmith*" }
$AllUserData | Write-host

That'll do it
0
 
QlemoBatchelor, Developer and EE Topic AdvisorCommented:
I now see your search base string contains a leading space, which might be an issue. Correct one should be:
$AllUserData = get-aduser -filter  * -SearchBase "CN=IS,DC=MyDomain,DC=com" -Properties * 

Open in new window

0
 
jskfanAuthor Commented:
I will try it later
Thank you
0
 
QlemoBatchelor, Developer and EE Topic AdvisorCommented:
You should try out before accepting. Alex' recommendation is changing the search - no or completely different results!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.