mjm21
asked on
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
sam, displayname, ("Status" disabled / or enabled), (has mailbox / or does not have mailbox), 90 days since lastlogon, parentcontainer
ASKER
I will test now....how about if user is disabled or enabled?
Should work either way if the user is disabled or not.
ASKER
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?
The list of users is so you don't bombard your DCs with a huge query. How many people are we talking about?
ASKER
2K
ASKER
Is this script pulling sam account names?
ASKER
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.
program. Check the spelling of the name, or if a path was included, verify that the path is correct and try a
gain.
Get-ADUser -LastLogon
ASKER
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.
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.
Are you leaving a space between Get-ADUser and -LastLogon?
make sure you run "Import-Module ActiveDirectory" otherwise it wont recognize AD cmdlets
make sure you run "Import-Module ActiveDirectory" otherwise it wont recognize AD cmdlets
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
The script that I put together did the job as good as I need it.
Import-Module ActiveDirectory
Get-Content -Path \\Path\to\FileOfUsers.txt | foreach-object { Get-ADUser -Identity $_ | Select Name, SamAccountName | Get-Mailbox | Get-ADUserLastLogon }