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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Qlemo"Batchelor", 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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Alex GreenProject Systems EngineerCommented:
$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
Qlemo"Batchelor", 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
Qlemo"Batchelor", Developer and EE Topic AdvisorCommented:
You should try out before accepting. Alex' recommendation is changing the search - no or completely different results!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Powershell

From novice to tech pro — start learning today.