Skip to content

Instantly share code, notes, and snippets.

@Dimtemp
Dimtemp / Certificate.ps1
Last active November 4, 2023 12:52
Check for certificate expiration
function Get-CertificateExpiration {
<#
.SYNOPSIS
Displays a list of certificates that will expire soon.
#>
param(
$Threshold = 30, #Number of days to look for expiring certificates
[string[]]$ComputerName
@Dimtemp
Dimtemp / ProcessMonitor.ps1
Last active June 7, 2025 02:32
Process monitor PowerShell
Function ProcessMonitor {
<#
.SYNOPSIS
Displays changes in the process list on this or a remote PC.
.DESCRIPTION
Great for monitoring logon/startup scripts, batch jobs, software installations, etc... Especially on terminal servers.
.EXAMPLE
ProcessMonitor
Compares changes in the process list every second on the local computer.
.EXAMPLE
@Dimtemp
Dimtemp / MultiPing.ps1
Last active December 6, 2023 13:45
Ping several computers with PowerShell: MultiPing
Function MultiPing {
<#
.SYNOPSIS
Sends a ping to a specified host. Colors the output to indicate latency.
.DESCRIPTION
Version 1.1. Provides a simple network monitoring solution, without the need to install any software.
.EXAMPLE
MultiPing ServerX
Sends a ping to ServerX every second. Repeats forever.
.EXAMPLE
@Dimtemp
Dimtemp / InventoryOneliner.ps1
Created November 2, 2023 13:59
Inventory oneliner
Get-Content pcs.txt | foreach { Write-Host $_ -f Green; $pc=$_; Get-Content wmi.txt | foreach { Get-WmiObject $_ -ComputerName $pc } }
@Dimtemp
Dimtemp / MessageOfTheDay.ps1
Created November 2, 2023 15:02
Message of the day
function Get-MessageOfTheDay {
<#
.SYNOPSIS
Displays a message of the dag.
#>
$msg =
'Knowledge is power -- Sir Francis Bacon',
'Power is the ultimate aphrodisiac -- Henry Alfred Kissinger',
'With great power comes great responsibility -- Uncle Ben',
@Dimtemp
Dimtemp / VMMNetworkControllerInstallationStatus.ps1
Created November 4, 2023 13:32
This function summarizes several important configuration settings during deployment of a Network Controller VM from System Center Virtual Machine Manager (VMM).
function Get-VMMNetworkControllerInstallationStatus {
<#
.SYNOPSIS
This function summarizes several important configuration settings during deployment of a Network Controller VM from System Center Virtual Machine Manager (VMM).
.NOTES
Info from Network Controller deployment scripts
PrepareNodeForNetworkController.ps1 configures:
Installation directory
@Dimtemp
Dimtemp / BpaBaseline.ps1
Created November 4, 2023 20:00
Best Practices Analyzer baseline
$BpaModel = 'Microsoft/Windows/WebServer'
$BaselineFile = 'baseline.xml'
Import-Module BestPractices
Invoke-BpaModel $BpaModel
Get-BpaResult $BpaModel | Export-CliXML $BaselineFile
@Dimtemp
Dimtemp / BpaCompare.ps1
Created November 4, 2023 20:00
Best Practices Analyzer compare with baseline
$BpaModel = 'Microsoft/Windows/WebServer'
$BaselineFile = 'baseline.xml'
Import-Module BestPractices
Invoke-BpaModel $BpaModel
$Bpa = Get-BpaResult $BpaModel
$BpaBaseline = Import-CliXML $BaselineFile
Compare-Object $BpaBaseline $Bpa -property Severity, Title, Resolution |
Where-Object SideIndicator -eq '=>'
@Dimtemp
Dimtemp / PowerShell-function-template-1.ps1
Created November 6, 2023 15:55
Simple template for a PowerShell function
function Verb-Noun {
<#
.SYNOPSIS
Short description
.DESCRIPTION
Long description
.EXAMPLE
Verb-Noun
Example of how to use this cmdlet
@Dimtemp
Dimtemp / functiontemplate.ps1
Created November 10, 2023 10:40
PowerShell function template
function Verb-Noun {
<#
.SYNOPSIS
Short description
.DESCRIPTION
Long description
.EXAMPLE
Verb-Noun
Example of how to use this cmdlet