Solved

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

Posted on 2013-11-07
13
1,067 Views
Last Modified: 2013-11-13
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
Comment
Question by:mjm21
  • 8
  • 3
  • 2
13 Comments
 
LVL 27

Expert Comment

by:Jason Watkins
ID: 39630487
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
 

Author Comment

by:mjm21
ID: 39630876
I will test now....how about if user is disabled or enabled?
0
 
LVL 27

Expert Comment

by:Jason Watkins
ID: 39630886
Should work either way if the user is disabled or not.
0
 

Author Comment

by:mjm21
ID: 39631238
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
 
LVL 27

Expert Comment

by:Jason Watkins
ID: 39631248
The list of users is so you don't bombard your DCs with a huge query. How many people are we talking about?
0
 

Author Comment

by:mjm21
ID: 39631261
2K
0
VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

 

Author Comment

by:mjm21
ID: 39631333
Is this script pulling sam account names?
0
 

Author Comment

by:mjm21
ID: 39631411
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
 
LVL 1

Expert Comment

by:elchermans
ID: 39631623
Get-ADUser -LastLogon
0
 

Author Comment

by:mjm21
ID: 39631791
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
 
LVL 1

Expert Comment

by:elchermans
ID: 39631849
Are you leaving a space between Get-ADUser and -LastLogon?

make sure you run "Import-Module ActiveDirectory" otherwise it wont recognize AD cmdlets
0
 

Accepted Solution

by:
mjm21 earned 0 total points
ID: 39631887
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
 

Author Closing Comment

by:mjm21
ID: 39644053
The script that I put together did the job as good as I need it.
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

MS Outlook is a world-class email client application that is mainly used for e-communication globally.  In this article, we will discuss the basic idea about MS Outlook, its advanced features, and types of MS Outlook File formats.
Read this checklist to learn more about the 15 things you should never include in an email signature.
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles to another domain controller. Log onto the new domain controller with a user account t…
This video discusses moving either the default database or any database to a new volume.

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now