Skip to content

Instantly share code, notes, and snippets.

View msoler8785's full-sized avatar
🤌
When you do things right, people won't be sure you've done anything at all.

Matt Soler msoler8785

🤌
When you do things right, people won't be sure you've done anything at all.
View GitHub Profile
@msoler8785
msoler8785 / Cleanup-Cruft.ps1
Created December 19, 2023 14:22
Disk Cleanup Script
# Delete all the Recycle Bins
Get-ChildItem -Path 'C:\$Recycle.Bin\' -Recurse -Hidden | Remove-Item -Force -Recurse -Verbose
# Delete all User Profiles on computer except active profiles.
# Warning! this will delete all documents and files under the user profile.
$profiles = Get-WMIObject -class Win32_UserProfile | Where-Object { $_.Special -eq $false -and $_.Status -eq 0 -and $_.Loaded -eq $false }
$profiles | Remove-WmiObject
@msoler8785
msoler8785 / Install-Winget.ps1
Created December 19, 2023 14:12
Install Winget on Windows Server
cd $env:USERPROFILE\Desktop
mkdir winget
cd winget
# Download appx bundles
if(-Not (Test-Path '.\microsoft.ui.xaml.2.7.3\tools\AppX\x64\Release\Microsoft.UI.Xaml.2.7.appx'))
{
Invoke-WebRequest -Uri https://www.nuget.org/api/v2/package/Microsoft.UI.Xaml/2.7.3 -OutFile .\microsoft.ui.xaml.2.7.3.zip
Expand-Archive .\microsoft.ui.xaml.2.7.3.zip
}
@msoler8785
msoler8785 / Send-MailMessageExample.md
Last active October 17, 2022 19:30
How to send messages via SocketLabs SMTP
# Configure your message HTML here.
$bodyHtml = @"
<html>
    <head>
        <title>Hello!</title>
    </head>
    <body>
        <h2>Hello SocketLabs!</h2>
 This is an example message.
@msoler8785
msoler8785 / DeleteTags.md
Last active September 12, 2022 17:42
Bulk Delete Git Tags

Bulk delete tags from a repo using PowerShell.

Run these commands from the root of your repo.

Function Delete-TagPattern 
{
    Param(
        [Parameter(
 Mandatory, 
@msoler8785
msoler8785 / README.md
Created December 15, 2021 19:14
How to install Unifi Network application to Program Files on Windows

The Problem

Many people want to install Unifi into the Program Files folder on Windows.
By default the installer installs into the current users profile folder.

For some reason there isn't any information on how to do this. Many people come up with all kinds of hacks such as using symlinks to achieve the same effect.

The Solution

In reality the UniFi-installer.exe is a Nullsoft NSIS installer that accepts the standard command line argument for specifying a directory

Just run this command and it will install it into the specified directory:

@msoler8785
msoler8785 / Create-PtrRecords.ps1
Last active April 2, 2024 19:25
Quick PowerShell script to automate PTR Record creation for existing forward lookup zones.
# Creates PTR Records for all A Records in the specified -ZoneName.
# Uses a Class A Subnet for the reverse zone.
$computerName = 'dns-server01';
# Get all the DNS A Records.
$records = Get-DnsServerResourceRecord -ZoneName 'zone.example.com' -RRType A -ComputerName $computerName;
foreach ($record in $records)
{
# The reverse lookup domain name. This is the PTR Response.
$ptrDomain = $record.HostName + '.zone.example.com';