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,063 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
Comment Utility
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
Comment Utility
I will test now....how about if user is disabled or enabled?
0
 
LVL 27

Expert Comment

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

Author Comment

by:mjm21
Comment Utility
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
Comment Utility
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
Comment Utility
2K
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:mjm21
Comment Utility
Is this script pulling sam account names?
0
 

Author Comment

by:mjm21
Comment Utility
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
Comment Utility
Get-ADUser -LastLogon
0
 

Author Comment

by:mjm21
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
The script that I put together did the job as good as I need it.
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Follow this checklist to learn more about the 15 things you should never include in an email signature from personal quotes, animated gifs and out-of-date marketing content.
This process describes the steps required to Import and Export data from and to .pst files using Exchange 2010. We can use these steps to export data from a user to a .pst file, import data back to the same or a different user, or even import data t…
In this video we show how to create an Address List in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Organization >> Ad…
This tutorial will walk an individual through the process of configuring their Windows Server 2012 domain controller to synchronize its time with a trusted, external resource. Use Google, Bing, or other preferred search engine to locate trusted NTP …

772 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