Skip to content

Instantly share code, notes, and snippets.

View SweetAsNZ's full-sized avatar
🏠

Tim West SweetAsNZ

🏠
View GitHub Profile
@SweetAsNZ
SweetAsNZ / Set-FirewallLogFile.ps1
Last active January 28, 2026 01:47
Sets up the Windows Firewall log file and folder with the correct permissions and creates the log files. Then prompts to reboot.
Function Set-FirewallLogFile {
<#
.SYNOPSIS
Sets up the Windows Firewall log file with the correct permissions.
.DESCRIPTION
This function creates a Windows Firewall log file at the specified location and sets the appropriate permissions for system services and administrators.
Requires Administrator privileges. System reboot is required for changes to take effect.
Added NetSH commands to configure firewall logging as overkill just in case.
Script works for standard and .old log files after reboot
@SweetAsNZ
SweetAsNZ / Set-UserPassword.ps1
Created January 26, 2026 20:24
Set an AD Users Password
function Set-UserPassword {
<#
.SYNOPSIS
Change your AD password, use SAMAccount Name to change another users password
.DESCRIPTION
Change your AD password, use SAMAccount Name to change another users password
.EXAMPLE
Set-UserPassword
.EXAMPLE
Set-UserPassword -SAMAccountName 'jsmith'
@SweetAsNZ
SweetAsNZ / Get-UsersPasswordPolicy.ps1
Last active January 19, 2026 19:54
Gets the effective password policy for a user, including fine-grained password policies if applied. Returns user password status along with policy requirements.
function Get-UsersPasswordPolicy {
<#
.SYNOPSIS
Retrieves password policy settings for a user from Active Directory.
.DESCRIPTION
Gets the effective password policy for a user, including fine-grained password policies if applied.
Returns user password status along with policy requirements.
.PARAMETER UserName
The username (SamAccountName) to query. Defaults to the current user.
.EXAMPLE
@SweetAsNZ
SweetAsNZ / Invoke-ExchangeDatabaseFailover.ps1
Last active January 19, 2026 21:41
Initiates a failover of an Exchange mailbox database to another server within its Database Availability Group (DAG). Waits if too may failovers have happened. Optionally choose the server or by default take the first one available
function Invoke-ExchangeDatabaseFailover {
<#
.SYNOPSIS
Initiates a failover of an Exchange mailbox database to another server within its Database Availability Group (DAG).
.DESCRIPTION
This function allows administrators to trigger a failover of a specified Exchange mailbox database to another server
within its Database Availability Group (DAG). Optionally, a target server can be specified for the failover.
.PARAMETER DatabaseName
The name of the Exchange mailbox database to failover.
.PARAMETER TargetServer
@SweetAsNZ
SweetAsNZ / Get-WindowsInfo.ps1
Last active January 23, 2026 01:42
Multiple Functions to get various Windows system information. Get-DNSServers, Get-DNS, Get-Gateway, Get-GW, Get-IP, Get-SubnetMask, Get-MACAddress, Get-MAC, Get-UpTime, Get-DiskSpace, Get-MappedDrives, Test-Gateway, Test-GW, Get-FreeSpace, Get-Proxy, Show-Proxy, Get-Routes
# Multiple Functions to get various Windows system information
# Get-DNSServers, Get-DNS, Get-Gateway, Get-GW, Get-IP, Get-SubnetMask, Get-MACAddress, Get-MAC, Get-UpTime, Get-DiskSpace, Get-MappedDrives, Test-Gateway, Test-GW, Get-FreeSpace, Get-Proxy, Show-Proxy, Get-Routes
# Version: 1.1.4
function Get-DNSServers {
<#
.SYNOPSIS
Gets DNS server addresses configured on the system.
.DESCRIPTION
Returns DNS server addresses configured on the system, optionally filtered by interface alias, IPv4 only, and status.
.PARAMETER All
@SweetAsNZ
SweetAsNZ / Get-VCRunTime.ps1
Last active December 10, 2025 01:45
Gets the latest/installed Visual C++ RunTime with PowerShell
function Get-VisualCRuntime {
<#
.SYNOPSIS
Get Visual Studio Latest Installed RunTime
.EXAMPLE
Get-VisualCRuntime
#>
[CmdletBinding()]
Param(
[switch]$Latest # See here for latest https://aka.ms/vc14/vc_redist.x64.exe, https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170
@SweetAsNZ
SweetAsNZ / Get-SpeedToMakeWithCourseDeviation.ps1
Last active December 11, 2025 08:25
Calculate a boat's current and new arrival time and average VMG for course changes using polar diagram data supply recommendations as to whether to change course to that angle or not
function Get-SpeedToMakeWithCourseDeviation {
<#
.SYNOPSIS
Calculate arrival time and average VMG for course changes using polar diagram data.
.DESCRIPTION
Calculates whether a course deviation is worthwhile by determining:
- Expected boat speed at the new course angle using polar diagram
- Velocity Made Good (VMG) toward the waypoint
- Estimated arrival time for current course vs altered course
.PARAMETER SOG
@SweetAsNZ
SweetAsNZ / Compare-WindowsFirewallLogs.ps1
Created December 2, 2025 21:46
Analyzes Windows Firewall logs of the local machine and another computer(s) to identify network traffic that is sent by a Windows Computer with no matching inbound traffic on the destination computer.
function Compare-WindowsFirewallLogs {
<#
.SYNOPSIS
Analyzes Windows Firewall logs of the local machine and another computer(s) to identify network traffic that is sent by a
Computer with no matching inbound traffic on the destination computer.
.DESCRIPTION
This function analyzes outbound traffic from the local computer and checks if the destination
computer(s) received that traffic. It identifies network communication failures, blocked connections,
or dropped packets by finding outbound SEND traffic that has no corresponding inbound RECEIVE traffic
on the destination server.
@SweetAsNZ
SweetAsNZ / Test-IEModeSessionStateSetting.ps1
Created December 2, 2025 21:39
Checks IE Mode Session State if Files Aren't Opening in IE Mode With Spinning Wheel on Edge Tab when you see multiple HTTP 302 errors in Fiddler
function Test-IEModeSessionStateSetting {
<#
.SYNOPSIS
Tests the Internet Explorer Mode session state settings for Microsoft Edge.
.DESCRIPTION
This function checks the registry for the Internet Explorer Mode session state settings
in Microsoft Edge under both HKLM and HKCU paths. It reports whether the settings are enabled, disabled, or not set.
Useful when IE Mode Files don't load with spinning wheel on Edge tab
.EXAMPLE
@SweetAsNZ
SweetAsNZ / Get-NetworkConnectionLogDedupedData.ps1
Created December 2, 2025 21:32
Gets a list of deduplicated IP's or Ports that hit the Computer using the output of Get-NetworkConnectionLog.ps1
function Get-NetworkConnectionLogDedupedData {
<#
.SYNOPSIS
Get deduplicated network connection log data with flexible property selection and time filtering.
.DESCRIPTION
Parses network connection log CSV files and returns unique combinations of selected properties.
Supports time-based filtering (last N minutes or hours) and flexible property selection for deduplication.
.PARAMETER FilePath
Path to the network connection log CSV file. If not specified, searches for the most recent log file
in the default location: $ENV:USERPROFILE\Documents\WindowsPowerShell\SCRIPTS\Network\Get-NetworkConnectionLog\