Skip to content

lovemonkeyz/PS-Portfolio

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PS-Portfolio

A collection of PowerShell scripts and modules built during years of IT Operations work — managing enterprise Windows fleets, VMware environments, Cisco networks, Intel AMT deployments, and Active Directory. Covers everything from quick daily-use utilities to fleet-scale automation.

All scripts have Get-Help compatible documentation. After dot-sourcing a script, run Get-Help <FunctionName> -Full for parameters and examples.


Contents


General Utilities

Script What it does
Invoke-WakeOnLan.ps1 Sends WoL magic packets over UDP to one or more MAC addresses. Pipeline-aware.
Ping-loop.ps1 Monitors a reboot — waits for machine to go offline, then back online. Reports elapsed time and shows a popup.
PingUntilOffline.ps1 Polls until a machine goes offline. Popup alert on completion. Pair with Ping-loop.
Convert-PowerShellToBatch.ps1 Wraps a .ps1 as a base64-encoded .bat that runs without changing execution policy. Pipeline-aware.
Get-SubdirectorySize.ps1 Reports folder sizes up to a configurable depth. Results in Out-GridView.
Get-LargeFiles.ps1 Recursively scans folders for files over a size threshold, optionally filtering by age. Exports per-path CSVs. Works with DFS — pipe Get-DfsnFolderTarget output directly.
Search-LogFiles.ps1 Searches a folder of log files for one or more string patterns. Reports match counts and first match per file with a progress bar.
Show-JobProgress.ps1 Relays Write-Progress output from background jobs to the calling console — fills the progress bar gap in Start-Job / Invoke-Command -AsJob.
Resolve-HostNameOrAddress.ps1 Resolves hostname → IP or IP → hostname in both directions, with structured error output.
Custom-Prompt.ps1 Drop-in $PROFILE prompt: history ID, current folder, right-aligned last-command time and clock, admin detection.

Windows & OS Management

Script What it does
Repair-WMIRepository.ps1 Full WMI reset — stops service, re-registers DLLs and MOFs, resets repository. Optional ConfigMgr client reinstall via -ManagementPoint and -CCMSetupPath.
Repair-WindowsUpdate.ps1 Fixes GP-corruption and registry-misconfiguration WU failures remotely. -Fix parameter selects PolicyCorruption, RegistryMisconfiguration, or Both.
ConvertTo-GPTDisk.ps1 Remote MBR→GPT conversion + UEFI/Secure Boot BIOS configuration for Windows 11 readiness. Handles HP and Lenovo via WMI; flags Dell for manual steps.
Set-BIOSWakeOnLan.ps1 Remotely enables WoL in the BIOS of HP and Lenovo workstations via manufacturer WMI namespaces. Supports BIOS password.
Register-WeeklyMaintenanceTask.ps1 Deploys a weekly scheduled task that suspends BitLocker and reboots. Useful for shared PCs, classrooms, and kiosks.
Watch-ComputerStatus.ps1 Live ANSI-coloured console dashboard: online/offline, free disk %, uptime, OS version. Refreshes on a configurable interval.
Get-LoggedOnUsers.ps1 Runs quser against multiple computers in parallel (PS7) or sequentially (PS5). Returns structured objects per session.
Get-InstalledPrinters.ps1 Lists all network printers mapped across all user profiles on a remote computer via registry.
Remove-UnknownUserProfiles.ps1 Deletes Windows user profiles whose SID cannot be resolved — cleans up stale profiles from deleted or domain-disjointed accounts.
UserProfileScripts.ps1 Two functions: Get-ProfileAgeAndSize (size + last-used per profile) and Remove-UnknownUsers (same as above, as a dot-sourceable function).

BitLocker

Script What it does
Enable-BitLockerWithPin.ps1 Interactive local script: checks GPT/SecureBoot/TPM, enables BitLocker with TPM+PIN, encrypts secondary drives with auto-unlock, saves recovery keys to a file path and backs them up to AD. Self-elevates.
Resume-BitLockerProtection.ps1 Audits BitLocker status across remote computers and resumes suspended protection. Fixes a known ReAgent.xml issue that blocks re-enabling. Returns structured status per machine.

Networking

Script What it does
Invoke-WakeOnLan.ps1 See General Utilities.
Get-DHCPAudit.ps1 Pulls DHCP leases, cross-references with AD (owner, OU, manager, job title), checks DNS/IP match, and checks BitLocker status. Exports to CSV.
Get-DFSDetails.ps1 Resolves a DFS UNC path to the actual server name, share, and local path behind the namespace. Uses NetDfsGetClientInfo via C# P/Invoke. (Jaap Brasser)
CiscoSwitchTools/ Module — given a hostname or IP, finds which Cisco switch port the device is physically connected to via SSH. See CiscoSwitchTools Module.

Active Directory

Script What it does
FUINDLAT/Find-UserInNestedDlTree.ps1 Recursively traverses a distribution list tree and returns every path through which a user is a member. Handles large groups (LDAP range retrieval), circular reference detection, configurable max depth. No RSAT required.
FUINDLAT/Invoke-DlRemovalRequest.ps1 Handles a DL removal request: checks if user is a direct or nested member, verifies the executing admin has permission to modify the group, generates a ready-to-send email template if not. -Remove switch performs the actual removal.
Test-Cred.ps1 Validates a PSCredential against LDAP before use. Returns "Authenticated" or "Not authenticated".
New-DoubleHop.ps1 Registers a PSSessionConfiguration named DoubleHop on a remote machine to solve the PowerShell credential delegation problem.
Get-TokenSize.ps1 Calculates a user's Kerberos token size from their AD group memberships. Flags risk of auth failures due to token bloat.
Remove-UnresolvedSID.ps1 Removes accounts from the local Administrators group that aren't from this machine or the joined domain. Supports -WhatIf.
Get-HomeFolderAudit.ps1 Parallel PS7 audit of home folder shares: size, last access, ACL owner, AD account status, HomeDirectory attribute match, optional stale-shortcut detection.
Get-OrphanHomeFolder.ps1 Finds home folders with no matching or disabled AD account. Optional size reporting, move-to-archive, robocopy support. (Jaap Brasser v1.9)

ConfigMgr / SCCM

Script What it does
Invoke-CMClientAction.ps1 Triggers ConfigMgr client schedule actions by name. Named actions: MachinePolicy, SoftwareUpdatesScan, SoftwareUpdatesDeployment, HardwareInventory, etc. Presets: StandardBundle (the common patching 3-action cycle), All.
Get-SCCMHealth.ps1 SCCM client health check and self-repair: verifies services, WMI namespace, client actions, reinstalls client if needed. -CCMSetupPath parameter for the install files location. (Kris Gross / sccmtst.com)
Repair-WMIRepository.ps1 See Windows & OS Management — includes optional SCCM client reinstall.

VMware / vSphere

Requires VMware PowerCLI and an active Connect-VIServer session.

Script What it does
Get-VMDeleteHistory.ps1 Returns a history of deleted VMs from the vCenter event log — who deleted what and when. (William Lam / VMware)
Get-VMBackupStatus.ps1 Audits VM backup custom attributes (Backup_Class, VM_Backup_Type, NB_LAST_BACKUP) and reports whether each VM's last backup matches its assigned policy class.
New-VMFromCSV.ps1 Bulk-creates VMs from a CSV using a template. Sets CPU/RAM post-creation, optionally sets backup annotations. Supports -WhatIf.

Intel AMT / Out-of-Band Management

Requires meshcmd — free tool from MeshCentral: https://www.meshcommander.com/meshcommander/meshcmd

Intel AMT is available on most business-class desktops and laptops (Core vPro). It allows power management and diagnostics independently of the OS — machines can be powered on even when fully off, as long as they have power and AMT is provisioned.

Script What it does
Start-MachineFleet.ps1 Powers on a fleet via AMT using meshcmd, then waits for each machine to come online. Reports machines that timed out.
Stop-MachineFleet.ps1 Shuts down a fleet via WinRM. -SuspendBitLocker suspends BitLocker for one reboot cycle so machines can be powered back on remotely without PIN entry.
Get-AMTStatus.ps1 Audits AMT readiness: LMS service status, ME firmware version, FQDN, and AMT provisioning state via meshcmd.

CiscoSwitchTools Module

A PowerShell module for Cisco network management via SSH. The main use case: given a hostname or IP address, find which physical switch port that device is connected to — tracing through core switch ARP tables and access switch MAC tables.

# Install dependency
Install-Module Posh-SSH

# Import
Import-Module .\CiscoSwitchTools\CiscoSwitchTools.psd1

# Find which port PC01 is connected to
Get-Port -HostName "PC01" -CoreSwitch "core-sw01.contoso.com"

# By IP
Get-Port -HostAddress "10.10.5.22" -CoreSwitch "core-sw01"

# Get details for a specific port directly
Get-Port -Port "Gi1/0/22" -NetworkSwitch "access-sw03"

Exported functions:

Function What it does
Get-Port Main entry point. Resolves hostname → IP → core switch → access switch → port.
Get-CiscoPortInfo Gets VLAN, speed, duplex, and status for a specific switch port.
Get-CiscoSwitchOS Detects whether a switch is running IOS, IOS XE, or NX-OS.

Requires: Posh-SSH (Install-Module Posh-SSH) and SSH credentials for the switches (read-only access is sufficient).

Original module by Linus Linusson. Reworked to replace hardcoded site-specific core switch mapping with a -CoreSwitch parameter.


Reference

File What it contains
Reference-Snippets.md Quick-reference patterns: Start-Process exit code capture, Get-WinEvent FilterHashtable, PS proxy setup, bulk registry key creation from CSV, Intel AMT meshcmd usage, and more.
Parse-Nmap.ps1 Parses nmap XML output files into structured PowerShell objects. (Jason Fossen / Enclave Consulting LLC / SANS)

Usage

Every script defines a named function (or uses script-level param()). Dot-source to load, then call with Get-Help for full documentation:

# Dot-source a script
. .\Invoke-WakeOnLan.ps1

# Get full help
Get-Help Invoke-WakeOnLan -Full

# Run
"AA:BB:CC:DD:EE:FF" | Invoke-WakeOnLan

For the CiscoSwitchTools module, use Import-Module instead:

Import-Module .\CiscoSwitchTools\CiscoSwitchTools.psd1
Get-Help Get-Port -Full

Scripts marked with #Requires -Version 7 need PowerShell 7+. All others run on Windows PowerShell 5.1 and PS7.


Requirements

Tool / Module Used by Install
RSAT: Active Directory AD scripts, DHCP audit Windows optional feature
RSAT: DHCP Server Tools Get-DHCPAudit Windows optional feature
RSAT: DFSN Get-DFSDetails Windows optional feature
VMware PowerCLI VMware scripts Install-Module VMware.PowerCLI
Posh-SSH CiscoSwitchTools Install-Module Posh-SSH
meshcmd AMT scripts https://www.meshcommander.com/meshcommander/meshcmd
PowerShell 7+ Get-HomeFolderAudit, Get-LoggedOnUsers -Parallel, Start-MachineFleet https://github.com/PowerShell/PowerShell

About

Some powershell scripts/tools I've built over the years (as well as some I've gathered online). No idea how much still works, this is just a portfolio. AI was used to quickly organise (add comment based help and instructions) and fix some scripts that were originally written for a single domain and specific OU pattern

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors