Hi Experts! - I am a newbie to powershell with experience over the last several months doing standard work as a systems admin..never been a scripter/programmer; but I am trying!
I am trying to right a script that will gather a list of all accounts in O365 and then do the tasks listed underneath:
A. Check each user account to determine if it has a mailbox
B. For each account that doesn't have a mailbox export the list to a spreadsheet
C. For each account that has a mailbox check if the mailbox "IsShared" by looking at the 'IsShared' property
D. For each account that has a mailbox get the last logon date
E. For each account that has a mailbox check the account to determine if it is licensed
Properties needed: Then for the lists I need out of these results I need to include these properties: Display Name, Alias, UPN, Last Logon date, License Value (True or False), if possible include what the account is licensed for such as Exchange, Lync, Sharepoint, Office, etc.
F. If the account has a mailbox and has been logged into within the last 30 days then get the list and export to excel or csv, including the properties in the note above
G. If the account has a mailbox and has not been logged into within the last 30 days then get the list and export to excel or csv
F. If the account/mailbox has not been logged into within the last 30 days then check for a license, but export to a separate csv or a separate sheet in excel
G. If the account "IsShared" then export it to a csv with properties noted above, and one csv is fine for shared mailboxes as I am not clear on if they are logged into constantly.
I have been able to write some queries to get the shared mailbox for one example, then a simple command that gets all users and provides a result of if they are licensed, but I am not going anywhere trying to write a 'script' that can do this and break out the results.