Hello, @Mani
Welcome to the Microsoft Q&A platform!
I can help you to pull a report for all generic accounts having General as Employee number along with Mailbox quota and last login details using PowerShell if you're working with Microsoft Exchange or Office 365.
Here's a script that can help you get the details for generic accounts with "General" as the Employee number, along with their mailbox quota and last login details:
Connect-ExchangeOnline
# Get all mailboxes
$mailboxes = Get-Mailbox -ResultSize Unlimited
# Filter mailboxes with Employee number "General"
$filteredMailboxes = $mailboxes | Where-Object { $_.EmployeeID -eq "General" }
# Prepare the report
$report = @()
foreach ($mailbox in $filteredMailboxes) {
$mailboxStats = Get-MailboxStatistics -Identity $mailbox.Alias
$mailboxQuota = Get-Mailbox -Identity $mailbox.Alias | Select-Object -ExpandProperty ProhibitSendReceiveQuota
$report += [PSCustomObject]@{
DisplayName = $mailbox.DisplayName
EmailAddress = $mailbox.PrimarySmtpAddress
MailboxQuota = $mailboxQuota
LastLoginTime = $mailboxStats.LastLogonTime
}
}
# Export the report to a CSV file
$report | Export-Csv -Path "C:\MailboxReport.csv" -NoTypeInformation
This script connects to Exchange Online, retrieves all mailboxes, filters those with "General" as the Employee number, and then gathers the mailbox quota and last login details. Finally, it exports the report to a CSV file.
Test results:
Since my account lacks the “$.EmployeeID” parameter that you need, I used the “$.UserPrincipalName” parameter in my test environment instead, so only one user's information is exported, you can modify it according to the script I provided above.
Regarding the OneDrive quota part, since I don't have much knowledge about OneDrive products, I have discussed this issue with my colleague in charge of OneDrive. You can refer to this document to make changes to your script : Microsoft 365: Get OneDrive for Business Usage Report using PowerShell - SharePoint Diary.
(Please Note: Since the web site is not hosted by Microsoft, the link may change without notice. Microsoft does not guarantee the accuracy of this information.)
If the answer is helpful, please click on “Accept answer” as it could help other members of the Microsoft Q&A community who have similar questions and are looking for solutions.
Thank you for your support and understanding.
Best Wishes,
Alex Zhang