• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

Clatent

Technology | Fitness | Food

  • About
  • Resources
  • Contact

365

One-Liner Wednesday January 18, 2023

January 18, 2023 by ClaytonT 2 Comments

Do you use 365? Ever needed a quick list of all your users and their mailbox size? What about having it nicely formatted? Or do you only want to see a certain size mailbox? This quick one-liner is a good starting point.

Get-EXOMailbox -ResultSize Unlimited | Get-EXOMailboxStatistics | Select DisplayName, ItemCount, TotalItemSize | Sort-Object TotalItemSize -Descending | Export-Excel -Path C:\scripts\MailboxSizes.xlsx -AutoSize

What this does is uses the current way to get a 365 mailbox(Get-mailbox is deprecated), grabs all the mailboxes, selects only the Display name, amount of emails, and total size of their mailbox. It will then put the largest mailbox at the top and smallest at the bottom. After all of that, it exports it to an excel file that you can manipulate how you like. If you haven’t already used Doug Finke’s ImportExcel module, I’d recommend it to get creative with your formatting without ever opening Excel to format. You could add it so all mailboxes over a certain size are a certain color.

Hope this helps let me know if you expand on this even if its not a one liner, I’d love to see!

Tagged With: 365, Exchange, One Liner Wednesday, PowerShell, Reporting

Module Monday November 28, 2022

November 28, 2022 by ClaytonT Leave a Comment

Hope all of my US friends had a good holiday! Now it’s Monday and we are back for another Module Monday. This is an important one, as it Is currently replacing a couple other modules as they are being depreciated. The 2 that are being depreciated are AzureAD and MSOnline if you didn’t know already. I’d check your scripts if you are still using them and convert them sooner than later.

So what is replacing these 2 modules? MS Graph, which doesn’t completely replace all the functionality as easily as we would like, but Microsoft is adding more features to it. This is how you will get license counts, Azure AD information, Teams, Exchange, Outlook, and any other 365 applications.

Also a great thing with Microsoft Graph is that it is cross-platform on PowerShell 7 and above so it doesn’t matter if you are using macOS, Linux, or Windows. You can still use it on Windows PowerShell 5.1 too.

PowerShell Gallery:

https://www.powershellgallery.com/packages/Microsoft.Graph/1.17.0

Microsoft Documentation:

https://learn.microsoft.com/en-us/powershell/microsoftgraph/overview?view=graph-powershell-1.0

Tagged With: 365, Microsoft Graph, Module Monday, PowerShell

Read-Only Friday November 25, 2022

November 25, 2022 by ClaytonT Leave a Comment

I know a lot of US workers have off today, but still wanted to post something as I know there are still many working and others who may have a little extra free time for learning. For today’s ROF, it really is a module or should I say modules, but the solution from these modules could be so helpful, I didn’t want someone to miss it.

The creator is called AsBuiltReport, which they have designed As Built Reports for different software and systems which you can customize what you want to see on the report and what thresholds should be for pass/fail.

Another way I could see using this to do to monthly/weekly/daily checks on your systems, and see if anything has been changed, but not only that, for certain(or all) systems it automatically changes back to the standard settings that it should be.

GitHub:

https://github.com/AsBuiltReport

Tagged With: AD, Fortinet, Nutanix, PowerShell, Read-Only Friday, Reporting, VMWare, Windows Server

One-Liner Wednesday November 23, 2022

November 23, 2022 by ClaytonT Leave a Comment

As we are approaching the holiday season  at the end of the year, dates are very important. Everything from counting down the days to the new year to creating those end of the year reports.

With that said, how many times have you had to create a report for the previous month, but it’s  parameters are only StartDate and EndDate? Now, you have to remember how many days are in that month and consider if it’s a leap year or not. And sometimes the first of the month is on a weekend, Holiday, or a day you took PTO so you have to make sure your code doesn’t just go back 30 days as then it may or may not get the whole previous month.  And let’s say for reasons you can’t control,  you can’t have it as a scheduled task to always run on the first of the month?

This one liner(technically 2 one for StartDate and one for EndDate), is the solution you need. It will check which month your in, go to the previous month then find the first and last day of that month. That’s it!

$StartDate = (Get-Date -Day 1).AddMonths(-1).ToString("yyyy-MM-dd")

$EndDate = (Get-Date -Day 1).AddDays(-1).ToString("yyyy-MM-dd")

If you wanted the past 6 months you could change the -1 to -6 in Start Date. Now you don’t have to manually enter the month date range every time you need a report for the previous month. You could set this as the default parameter, but give yourself the option to change it if you need a different date range.

Documentation:

Get-Date:
Microsoft Learn

Tagged With: Get-Date, One Liner Wednesday, PowerShell, Reporting

One-Liner Wednesday October 26, 2022

October 26, 2022 by ClaytonT Leave a Comment

One Liner Wednesday Cyber Security Edition

Want to see the top Malware that hits your 365 Exchange? Try this one liner out

Get-MailTrafficSummaryReport -Category TopMalware -StartDate 08-01-2022 -EndDate 10-25-2022 | Select-Object C1,C2 | out-gridview

This will give you the different types of malware Microsoft has found and how many times it found in since August 1. Then it will display it in a grid view that you can filter. I normally export to Excel/CSV to keep the data as it goes away after 90 days. Bigger organizations I’d recommend pushing it into a database for longer term analytics.

Check out Microsoft Docs and my 365 GitHub Repository for more ideas!

Microsoft Documentation:
Get-MailtrafficSummaryReport

365 Exchange Security Dasboard(Very early stages)
365 Exchange Security Dashboard

My Microsoft 365 GitHub Repository:
Powershell365

Tagged With: 365, Automation, One Liner Wednesday, PowerShell, Reporting

One-Liner Wednesday October 19, 2022

October 19, 2022 by ClaytonT Leave a Comment

New-TenantAllowBlockListItems -ListType Sender -Block -Entries emailaddress

Here is a super useful one liner that has come in handy more recently.

What this does is adds a user or domain to the tenant block list as it’s written below. If you need to add someone to the allow list, you can change -Block to -Allow. You can even change set a duration for both Blocking and Allowing.

Command:
New-TenantAllowBlockListItems

Example with Parameters:

Add-365Blocklist

Tagged With: One Liner Wednesday, PowerShell, Security

Primary Sidebar

Clayton Tyger

Tech enthusiast dad who has lost 100lbs and now sometimes has crazy running/biking ideas. Read More…

Find Me On

  • Email
  • GitHub
  • Instagram
  • LinkedIn
  • Twitter

Recent Posts

  • One-Liner Wednesday January 25, 2023
  • Module Monday January 23, 2023
  • One-Liner Wednesday January 18, 2023
  • Module Monday January 16, 2023
  • Read-Only Friday January 13, 2023

Categories

  • 365
  • Active Directory
  • Cim
  • Dashboards
  • Documentation
  • Get-WMI
  • Learning
  • Module Monday
  • Nutanix
  • One Liner Wednesday
  • Passwords
  • PDF
  • PowerShell
  • Read-Only Friday
  • Reporting
  • Security
  • Windows
  • WSUS

© 2023 Clatent