Skip to content

Instantly share code, notes, and snippets.

View SweetAsNZ's full-sized avatar
🏠

Tim West SweetAsNZ

🏠
View GitHub Profile
@SweetAsNZ
SweetAsNZ / Get-FirewallDropOrAllows.ps1
Last active May 23, 2025 02:42
Parse Search Get Windows Firewall Logs for Drops or Allows by IP Within X Hours Before Now
<#
.Synopsis
Get Local Windows Firewall Drops or Allows
.DESCRIPTION
Long description
.EXAMPLE
Get-FirewallDropOrAllows -IP 1.1.1.1 -DropOrAllow Drop -MinsAgo 1
.EXAMPLE
#WIP
Get-FirewallDropOrAllows -IP 10.1.1.1 -DropOrAllow Drop -Protocol 'TCP' -HoursAgo 1 -ExportToCSV:$true
@SweetAsNZ
SweetAsNZ / Get-VLAN.ps1
Created May 22, 2025 20:55
Get Windows Computer VLAN with PowerShell
function Get-VLAN {
Write-Host -f Green "For a Physcial Box:"
Get-NetAdapter | Select-Object Name,VlanID
Write-Host -f Green "For a VMware VM:"
Get-VM -Name $ENV:COMPUTERNAME | Get-VirtualPortGroup #| Select Name, VLanId
}
@SweetAsNZ
SweetAsNZ / Get-iSCSiNQN.ps1
Created May 22, 2025 20:53
Get iSCSi NQN Unique Identifier with Windows PowerShell
function Get-iSCSiIQN {
Write-Host -f Green "$($env:COMPUTERNAME)`r`n"
Get-InitiatorPort | Select-Object -ExpandProperty NodeAddress
}
@SweetAsNZ
SweetAsNZ / Disable-iPv6.ps1
Last active May 22, 2025 20:53
Disable IPv6 Properly with Windows PowerShell
function Disable-iPv6 {
#Requires -RunAsAdministrator
# Self-elevate the script if required
if( ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator") -eq $false){
Write-Warning "Run As Admin Required"
}
if( ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator") -eq $true){
Write-Host -f Green "Running As Admin - Success"
}
@SweetAsNZ
SweetAsNZ / Get-UPN.ps1
Created December 7, 2022 01:14
Get UPN User Principal Name/UserPrincipalName
# Requires no Active Directory Module or rights.
$UPN = (([ADSISEARCHER]"samaccountname=$($env:USERNAME)").Findone().Properties).userprincipalname ; $UPN
@SweetAsNZ
SweetAsNZ / Connect-Exchange.ps1
Created December 7, 2022 01:12
Connect to Exchange Online and Pass Your UPN
function Connect-Exchange
{
$UPN = (([ADSISEARCHER]"samaccountname=$($env:USERNAME)").Findone().Properties).userprincipalname ; $UPN
Connect-ExchangeOnline -UserPrincipalName $UPN -ShowProgress $true
}
@SweetAsNZ
SweetAsNZ / Get-VeeamJobSizes.ps1
Created December 2, 2022 04:12
Get Veeam Job Sizes
. C:\SCRIPTS\VEEAM\Connect-Veeam\Connect-Veeam.ps1 # Load the Connect Veeam Function
Connect-Veeam -VeeamServer $ENV:COMPUTERNAME
$JobSizes = Get-VBRBackup | Select @{N="Job Name";E={$_.Name}}, @{N="Size (GB)";E={[math]::Round(($_.GetAllStorages().Stats.BackupSize |
Measure-Object -Sum).Sum/1GB,1)}}
$JobSizes | Format-Table -AutoSize
$JobSizes | Export-CSV -NoTypeInformation $OutJobSizes
@SweetAsNZ
SweetAsNZ / MyVeeamReport.ps1
Created December 2, 2022 03:17
Gets All The Info From Veeam
#Requires -Version 3.0
#Requires -PSEdition Desktop
#Requires -Module @{ModuleName="Veeam.Backup.PowerShell"; ModuleVersion="1.0"}
<#
.SYNOPSIS
My Veeam Report is a flexible reporting script for Veeam Backup and
Replication.
.DESCRIPTION
My Veeam Report is a flexible reporting script for Veeam Backup and
<#
.SYNOPSIS
Deploy Multiple VMs to vCenter
.DESCRIPTION
VMs are deployed asynchronously based on a pre-configured csv file (DeployVM.csv)
.PARAMETER csvfile
Path to DeployVM.csv file with new VM info
@SweetAsNZ
SweetAsNZ / Check-ServerBackup.ps1
Last active November 23, 2022 22:30
Check if a Server is Being Snapshotted in a Veeam backup and What Job a Server is Being Backed up In
<#
.Synopsis
Checks Veeam Snapshot Backups For A Given Server Name. Also finds the Job that Server is being snapped in
.DESCRIPTION
.EXAMPLE
Check-ServerBackup -ComputerName Server01
.EXAMPLE
Check-ServerBackup -ConnectVeeamServer:$true -ReloadQuery:$true -ComputerName Server02
#>