Category: Powershell

Remove Spam/Phishing Email From All Mailboxes

In 365, you can use Compliance Searches to search and/or remove emails across all of your user’s mailboxes. Compliance searches have replaced the Search-Mailbox cmdlet, which has been deprecated as of April 2020. Pre-Requisites You must be a member of the Discovery Management role group or be assigned the Compliance Search management role. Here’s how …

Continue reading

Clean No-Intro 2018 ROM Set

IMPORTANT UPDATE 6/07/2023 – Major Rewrite for v6.0!!! Overview I did not want my RetroPie to be cluttered with ROMs I did not want. I only wanted the original games, I did not want duplicates or revisions, and I only wanted games in English so I could read the on screen text. For example, the …

Continue reading

Remove RDS CALs from RDS Server

Stop Remote Desktop Licensing Service

Background There are many circumstances where you will need to remove a RDS CALs from an RDS Server, or in some cases you want to rebuild the entire RD licensing database.  Microsoft allows you to remove an individual CAL license pack using powershell, or rebuild the entire database.  However, if neither of those work, it’s …

Continue reading

Complex Password Generator

Function Get-RandomPassword { param( $length = 10, $characters = ‘abcdefghkmnprstuvwxyzABCDEFGHKLMNPRSTUVWXYZ123456789!”??$%&/()=?*+#_’ ) $random = 1..$length | ForEach-Object { Get-Random -Maximum $characters.length } $private:ofs=”” [String]$characters[$random] } Function Randomize-Text { param( $text ) $number = $text.length -1 $indexes = Get-Random -InputObject (0..$number) -Count $number $private:ofs=” [String]$text[$indexes] } Function Get-ComplexPassword { $password = Get-RandomPassword -length 8 -characters ‘abcdefghiklmnprstuvwxyz’ $password …

Continue reading

365 Password Generator

This powershell script bulk generates passwords in a similar style as the password generator in Office 365.  The passwords begin with a capital letter, followed by 5 lower case letters, and 2 digits at the end.  You can modify the pattern to suite your needs (Note: It’s using the ASCII table ranges as the set …

Continue reading

Determine If Distribution Group is Being Used in 365 Exchange

“What distribution groups are in use?” and “How many emails are sent to a specific distribution group per month?” are common questions I receive with 365 Exchange or Exchange.  Unfortunately, there is nothing built in that tracks how many emails on sent to a distribution group.  However we can use Get-MessageTrace to count the number …

Continue reading

List All DNS Records with Powershell

UPDATED 6/16/2016 Thanks for the comments! Here’s a nice quick script to list all DNS records in each zone on the DNS server(includes sub-zones): From the DNS Server $Zones = @(Get-DnsServerZone) ForEach ($Zone in $Zones) { Write-Host “`n$($Zone.ZoneName)” -ForegroundColor “Green” $Zone | Get-DnsServerResourceRecord } From a Remote DNS Server $DNSServer = “servernameOrIp” $Zones = @(Get-DnsServerZone …

Continue reading

Search for Emails in a 365 User’s Mailbox

EDIT: Search-Mailbox has been deprecated as of April 2020 in 365.  Please see my updated post that about using Compliance Search instead! Overview Often times, my posts are influenced by the questions of others in IT forums.  The other day, an IT pro asked “How can I retrieve emails a 365 user sent to a certain …

Continue reading

Determine If A Date Is Between Two Dates

If you need to know if a date is between two dates, you can easily figure this out by treating the date as a number and doing comparisons.  This can be useful for instances where you need a script to do a different task on different months, days, years, etc.  Let’s start with our first …

Continue reading

Mail Merge with Attachment

There is not native way to add an attachment when doing an mail merge in Microsoft Office (Outlook/Word/Excel).  However, there are 3rd party apps that allow you to add attachments when doing a mail merge, but these programs usually cost $.  If you’re like me and don’t want to spend money on an application you’ll …

Continue reading