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,083 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

 

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
 

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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

A project that enables an administrator to perform actions within a user session context not just at the time of login but any time later on day(s) or week(s) later.
A recent project that involved parsing Tableau Desktop and Server log files to extract reusable user queries for use in other systems. I chose to use PowerShell to gather the data, and SharePoint to present it...
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 demonstrates how to sync Microsoft Exchange Public Folders with smartphones using CodeTwo Exchange Sync and Exchange ActiveSync. To learn more about CodeTwo Exchange Sync and download the free trial, go to: http://www.codetwo.com/excha…

738 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