Scripting
How to Create Self-Signed SSL for WebSites with PowerShell
Generate SSL for HTTPS with PowerShell ... [Read More]
How to Create Self-signed Client Authentication Certificate with PowerShell
Generate self-signed SSL certificate on a Windows computer ... [Read More]
How to Get All Teams a User is a Member | M365
List all teams in M365 where a user is a member ... [Read More]
Query User OneDrive With PowerShell
Query all OneDrive and SharePoint sites in the organization, or filter for a specific user ... [Read More]
Disable or Enable AzureAD Password Expiration with PowerShell
Use PowerShell to disable or enable AzureAD user account password expiration for a single user or in bulk ... [Read More]
Show Error Details – PowerShell
How to get verbose PowerShell error messages ... [Read More]
How to Test Open Port in PowerShell
Two ways to check open ports with PowerShell ... [Read More]
Easy Password Generator in PowerShell
Use PowerShell to generate randomized passwords in a length and count you want! ... [Read More]
PowerShell: How to parse a large one-line XML
Parse unformatted (one-liner) xml files, adding line breaks and indentation using Linux ... [Read More]
PowerShell: How to Reverse an Array
Learn how to reverse an array of any kind in PowerShell ... [Read More]
How Does UTF-8 Encoding Work
Learn what the UTF-8, UTF-16 and UTF-32 encodings are, how they work, what is BOM and how variable length encoding is utilized to represent over a 100 thousand characters in a simple text file ... [Read More]
How to Move Files from Multiple Subfolders to a Single Folder with PowerShell?
How to move all files that matches a pattern from subdirectories to a cetralized target location ... [Read More]
PowerShell: Extract Pattern from a String
Two methods of extracting text from an input string with PowerShell using regex expressions ... [Read More]
Regex tricks – Remove leading and trailing white spaces with Notepad++ and Vim
Learn how to remove leading and trailing whitespaces with either Notepad++ or Vim ... [Read More]
Grep command in PowerShell (recursive)
A simple function to mimic the Unix recursive grep command ... [Read More]
Convert to and from Epoch Time using PowerShell
Converting date and time to Epoch (Unix) time, and Epoch time back to human readable date ... [Read More]
PowerShell – How to Decrypt a SecureString
Two ways to decrypt a SecureString in PowerShell ... [Read More]
Base64 Encode with Fixed Line Length Output in PowerShell
Here is an example script that encodes an arbitrary text with Base64 method using PowerShell and breaks up the output into fixed-length lines to make it more easily readable. We use 76 character long rows as the MIME (Multipurpose Internet ... [Read More]
Split a String Into Fixed Length Lines in PowerShell
A one-liner to split up a long string into fixed-length rows in PowerShell ... [Read More]
How to List the Total Size of a Folder with PowerShell
List the total size, the subfolder-count, and the file-count of a folder or subfolder in PowerShell ... [Read More]
How to Clone a Role Assignment Policy in Microsoft Exchange
This script is for cloning a Role Assignment Policy in Exchange. For example, if you want to allow certain users to add/remove members to the distribution groups they own, you need to enable the "MyDistributionGroups" option in the role assignment ... [Read More]
PowerShell – How to add extra column to a CSV Export
Have you ever found yourself in a situation where you wanted to export the output of a PowerShell cmdlet or script, but needed to add an extra column to the output to export to a CSV file? Let's see how ... [Read More]
PowerShell: List Automapped Mailboxes for All Mailboxes in Exchange 2016
This script is for exporting all the mailboxes that have users auto-mapped with FullAccess rights. The script is for on-prem Exchange environments ... [Read More]
How to Export Users from Nested AD Groups
The following GetADGroup function will help to display all users who are a member of an AD or distribution group, no matter how deep they are located in nested structures ... [Read More]
Random Password Generator in PowerShell
A one-liner to generate passwords with PowerShell. Specify the length and the characters that builds up the passwords and off you go! ... [Read More]
Bash Tips for Daily Use
Have you ever needed to edit a config file after checking it's permissions, finding yourself typing in the same long file path twice in the shell? Or wondering how you can rerun the command you used a few steps ago ... [Read More]
Script to Customize the look of a PowerShell Window
A PowerShell window looks pretty unified when it starts up. Especially if there are multiple windows open at the same time it might be helpful if they were distinguishable. Like a different color as the background, or a specific title ... [Read More]
Check folder sizes in Exchange with PowerShell
The script returns the cumulative size of the requested folder with and without subfolders counted in ... [Read More]
Automatically Renewing FREE SSL on Zimbra
We already covered how to get LE certificates for CentOS boxes, this time we incorporate that knowledge into a script to get and automatically renew the SSL certificate for our Zimbra server running on CentOS 8 ... [Read More]
Install-PackageProvider: No match found error when installing PowerShell modules | FIX !
The Issue PowerShell - Install-PackageProvider: No match found error when installing PowerShell modules | FIX ! In a new deployment of Windows Server 2016 or 2019 when using the Install-Module [xxx] command you might be prevented with the following error ... [Read More]
Regex tricks – Remove empty lines with Notepad++ and Vim
Quickie guide for removing empty lines with Notepad+ and Vim ... [Read More]
Regex tricks – Remove Commented Out Lines with Notepad++ or Vim
Both Notepad++ in Windows and Vim in unix-type machines are perfectly capable of using regular expressions which is a super handy tool in an admin's hands ... [Read More]
Dealing With SUPER LONG file path in Windows
After abandoning the 8.3 file name limitation (pre-Win95 all files had a max name length of 8 characters, and a 3-char long extension), the Windows Win32 API allowed whole file paths to be as long as 260 characters long. However, ... [Read More]
Storing Passwords for PowerShell Scripts – ALWAYS WORKS!
In case you cannot use the CredentialManager PowerShell module to store and retrieve user credentials, but you still need to securely store user passwords or other confidential data there is another way to do so. 1. Securely Encrypt and Store ... [Read More]
Base64 Encoder and Decoder Algorithm in PowerShell – with Examples
The idea of encoding and decoding to- and from Base64 using PowerShell is based on the very same algorithm as we used in our Python example. In this short article we go through the process of encoding and then decoding ... [Read More]
Base64 Encoder and Decoder Algorithm from Scratch in Python
In Python there is a built-in Base64 encoder/decoder ready to use. Here is a very simple example on how to encode and decode using the built-in base64 library ... [Read More]
SID to SamAccountName and vice-versa
The quick way to get a user's SID or identify a SID if the username is unknown. First we use the command line to retrieve the reqested values, then a custom PowerShell function that can be used to get any ... [Read More]
PowerShell script for mass-creating Distribution Groups
Do you want to automate distribution group creation, making your job easier? With this script you'll be able to mass-create distribution groups. It takes a simple text file as an input that contains a list of delivery group names, and ... [Read More]
PowerShell Abbreviation Table
Have you ever wondered while typing the same long PowerShell command again and again, that there must be an abbreviation for at least a few of them? Here you go! ... [Read More]
How to SECURELY store credentials for PowerShell scripts
Every day we need to log into hundreds of portals, as it is important for security, there must be a way to script it, automate logins without putting our actual passwords in scripts in plain text, right? Luckily this is ... [Read More]
How to Create and Use Custom Powershell Commads
Custom commands John needs to access Exchange PowerShell a lot. He's tired of logging in the actual Exchange server all the time, he prefers to use his local computer to run cmdlets and manage mailboxes. He created a script, called ... [Read More]
Math: X To The Power of Y in PowerShell
Math in PowerShell is very simple and straightforward, the basic operators work as they usually do in any programming or scripting language: 1 + 1, 64 - 16, 4 * 32, 1024 / 128, etc. However, many times I faced ... [Read More]
Exchange Powershell Login to Office365 and Exchange 2016, 2019
Making the PowerShell connection to the remote Exchange Online Office365 servers and connecting to an on premises server that is local to the organization are slightly different. Connect to Office365 Connecting to Office365 consists of three different, separate connections. One ... [Read More]