• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1105
  • Last Modified:

Powershell / Quest cmdlet script that will output the following: sam, displayname, ("Status" disabled / or enabled), (has mailbox / or does not have mailbox), 90 days since lastlogon, parentcontainer

Powershell / Quest cmdlet script that will output the following:

sam, displayname, ("Status" disabled / or enabled), (has mailbox / or does not have mailbox), 90 days since lastlogon,  parentcontainer
0
mjm21
Asked:
mjm21
  • 8
  • 3
  • 2
1 Solution
 
Jason WatkinsIT Project LeaderCommented:
Sorry, but what is the question? This should get you started...

Import-Module ActiveDirectory
Get-Content -Path \\Path\to\FileOfUsers.txt | foreach-object { Get-ADUser -Identity $_ | Select Name, SamAccountName | Get-Mailbox | Get-ADUserLastLogon }
0
 
mjm21Author Commented:
I will test now....how about if user is disabled or enabled?
0
 
Jason WatkinsIT Project LeaderCommented:
Should work either way if the user is disabled or not.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
mjm21Author Commented:
Looks like I have to provide a list of users for this to work correct?  Why cant it just check all of AD and output the results to a CSV file?
0
 
Jason WatkinsIT Project LeaderCommented:
The list of users is so you don't bombard your DCs with a huge query. How many people are we talking about?
0
 
mjm21Author Commented:
2K
0
 
mjm21Author Commented:
Is this script pulling sam account names?
0
 
mjm21Author Commented:
The term 'Get-ADUserLastLogon' is not recognized as the name of a cmdlet, function, script file, or operable
program. Check the spelling of the name, or if a path was included, verify that the path is correct and try a
gain.
0
 
elchermansCommented:
Get-ADUser -LastLogon
0
 
mjm21Author Commented:
The term 'Get-ADUser-LastLogon' is not recognized as the name of a cmdlet, function, script f
ile, or operable program. Check the spelling of the name, or if a path was included, verify t
hat the path is correct and try again.
0
 
elchermansCommented:
Are you leaving a space between Get-ADUser and -LastLogon?

make sure you run "Import-Module ActiveDirectory" otherwise it wont recognize AD cmdlets
0
 
mjm21Author Commented:
The script was not working.  Thanks anyway.

Used this one:  get-qaduser –sizelimit 10 IncludeAllProperties | select samaccountname,displayname,accountisdisabled,lastlogon,dn,parentcontainerdn,homemdb,msexchhomeservername | export-csv c:\test\userinfo1.csv -notype
0
 
mjm21Author Commented:
The script that I put together did the job as good as I need it.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 8
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now