Posts

Base64 Conversion Functions in PowerShell: Automating Everyday Administrative Tasks

Base64 Conversion Functions in PowerShell: Automating Everyday Administrative Tasks In today's IT environments, automation is crucial for handling repetitive tasks and improving efficiency. PowerShell, with its rich set of tools and functions, provides a powerful framework for automating these tasks. One essential skill for any administrator is the ability to manipulate binary data, such as files, in a format suitable for transmission or storage. This is where Base64 encoding and decoding come in handy. Why Use Base64 Encoding? Base64 encoding is a way to represent binary data as plain text. This technique is frequently used when transferring data over systems that handle text rather than binary, such as JSON, XML, or APIs. Converting a file to Base64 can be useful when embedding files into scripts or sending them via web requests. Conversely, decoding Base64 back to its original binary form allows you to restore files for further use. In this article, we’ll w

Automating API Queries in PowerShell: A Practical Guide to Fetching Election Results and Updating Web Pages

Automating API Queries in PowerShell: A Practical Guide to Fetching Election Results and Updating Web Pages PowerShell is not just a scripting language; it’s an empowering automation tool that has become indispensable in today’s dynamic IT infrastructure. Its versatility allows system administrators and developers alike to harness the full potential of their environments, automating repetitive tasks and integrating disparate systems with ease. One of its most powerful capabilities is the ability to interact with APIs (Application Programming Interfaces), which facilitate seamless communication between software applications. With APIs at your fingertips, you can automate processes, fetch real-time data, and enhance service integrations like never before. As Jeffrey Snover, the inventor of PowerShell, aptly puts it, “The real power of PowerShell is that you can do anything you want.” This profound flexibility empowers IT professionals to take control of their workflow

Invoke-Logoff

Image
Invoke-Logoff Logoff a target User By Michael J. Thomas 04/24/2024   I decided to pull one of my older scripts off the back burner and share it with the world. This script has been handy for me with persistent account lockouts. The user has their password changed but has logged into multiple machines and the older password is locking the machine out. This script allows you to just target that computer and user and log them out.  <# .Synopsis    Logoff User off a Remote Computer.  .DESCRIPTION    Invoke-Logoff v1.0 Used to Logoff a User from a Remote Computer.    This also tests if a computer is online and if WinRM is enabled.         Created by Michael J. Thomas 9/11/2018.    Updated 12/27/2018  .EXAMPLE    Invoke-Logoff -ComputerName "computer01" -UserName "user01" #> Function Invoke-Logoff { [cmdletbinding()] param (                 [String]$ComputerName, [String]$UserName #[Parameter(Mandatory = $true)] ) Function Get-QUser { [cmdletbind

Get-WinVer

#Created by Michael J. Thomas #Last Updated 8/12/2022   Function Get-WinVer { Param ( $ComputerName ) $WinVer = (get-wmiobject win32_operatingsystem -ComputerName $ComputerName).Version #Threshold 1 10240 #Threshold 2 10586 #Redstone 1 14393 #Redstone 2 15063 #Redstone 3 16299[h] #Redstone 4 17134 #Redstone 5 17763 #19H1 18362 #19H2 18363 #20H1 19041 #20H2 19042 #21H1 19043 #21H2 19044 #22H2   19045 Switch ($WinVer){ "10.0.10240"{"Windows 10 Threshold 1"} "10.0.10586"{"Windows 10 Threshold 2"} "10.0.14393"{"Windows 10 Redstone 1"} "10.0.15063"{"Windows 10 Redstone 2"} "10.0.16299"{"Windows 10 Redstone 3"} "10.0.17134"{"Windows 10 Redstone 4"} "10.0.17763"{"Windows 10 Redstone 5"} "10.0.18362"{"Windows 10 19H1"} "10.0.18363"{"Windows 10 19H2"} "10.0.19041"{"Windows 10 20H1&

Set-EmailSizeLimit

Image
  Set-EmailSizeLimit Fix Outlook OST/PST Max Size Limit with PowerShell By Michael J. Thomas I decided to look into some of my projects I did in the past and post some of them here. I created this project when I saw mailboxes that were really large in size like over 50 Gb which were freezing up the outlook mailbox on the local system and users were not able to send out their email.  The server had plenty of space with Office 365 but there were no group policies in place at the time that allowed the systems to have even larger OTS/PST files on the local system.  I created a local solution to fix these right away. One is a program that I made with PowerShell Studio that you can copy to the computer and set the size. The other solution is a PowerShell script that allows you to set the permissions to a remote computer and user. Check them both out and let me know what you think. Hopefully, you will find this to be a handy tool. Enjoy! GUI for Fix Outlook OST/PST Max Size Limit Project Down

Start-Website

Image
  Start-Website Start a website with which ever browser you want it to start with PowerShell By Michael J. Thomas The other day I had built a function that could start a website with which ever browser I decided I wanted it to open with. This comes in handy when testing websites that you build or just with opening sites that are better compatible with one browser over the other. Here is this cool function.  Download Code from GitHub <# .Synopsis    Start-Website with a browser selection option.  .DESCRIPTION    Start-Website function is used to select which web browser you want to open a website with.  .EXAMPLE    Start-Website -Site PowerShellWeekly.com -Browser Edge .EXAMPLE    Start-Website PowerShellWeekly.com Edge     Start-Website ProgrammingEveryDay.com Edge     .EXAMPLE    Start-Website -Site ThomasITServices.com -Browser Chrome .EXAMPLE   Start-Website -Site https://www.affauto.com -Browser IE #> function Start-Website { [CmdletBinding()] param ( [String]$Site, [Validate

Install Admin Pack on Remote Computer

Image
  Install-AdminPack Enable Admin Pack on Remote Computer with PowerShell By Michael J. Thomas There are many ways to get the job done but here is a solution to installing admin pack on a remote computer.  You may have other members of your IT team that need to have this installed on their computer but you don't want to get up and go to their computer. That is the magic of PowerShell Remote Administration.    $ComputerName = "RemoteComputer" Enter-PSSession -ComputerName $ComputerName #If there is a Group Policy blocking Windows Update then do this: Set-ItemProperty -Name "UseWUServer" -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" -Value "0x00000000" -Type Dword  Restart-Service wuauserv Start-Sleep 2 #Register a Job to run this task for Installing Active Directory Tools $Name='Capability' Register-ScheduledJob -Name $name -ScriptBlock {Add-WindowsCapability -Online -Name "Rsat.ActiveDirectory.DS-LDS.Tools~~~~