Skip to content

Instantly share code, notes, and snippets.

@developerprofiles
developerprofiles / settings.json
Created June 14, 2021 17:31 — forked from jdhitsolutions/settings.json
My Windows Terminal settings file.
// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation
// PROSPERO
{
"$schema": "https://aka.ms/terminal-profiles-schema",
"defaultProfile": "{993855ad-b0eb-4f3d-8370-1a8d5b53abb5}",
// Launch Settings
"initialCols": 135,
"initialRows": 35,
// You can add more global application settings here.
@developerprofiles
developerprofiles / Get-WMIADEvent.ps1
Created June 14, 2021 17:31 — forked from jdhitsolutions/Get-WMIADEvent.ps1
PowerShell code to watch for Active Directory Events
<#
This is old code that still works in Windows PowerShell
as a temporary event subscriber for Active Directory events.
#>
Function Get-WmiADEvent {
Param([string]$query)
$path="root\directory\ldap"
$EventQuery = New-Object System.Management.WQLEventQuery $query
$scope = New-Object System.Management.ManagementScope $path
@developerprofiles
developerprofiles / ADChangeReport.ps1
Created June 14, 2021 17:30 — forked from jdhitsolutions/ADChangeReport.ps1
A PowerShell script to create an HTML report on recent changes in Active Directory.
#requires -version 5.1
#requires -module ActiveDirectory,DNSClient
# https://jdhitsolutions.com/blog/powershell/8087/an-active-directory-change-report-from-powershell/
#Reporting on deleted items requires the Active Directory Recycle Bin feature
[cmdletbinding()]
Param(
[Parameter(Position = 0,HelpMessage = "Enter a last modified datetime for AD objects. The default is the last 4 hours.")]
[ValidateNotNullOrEmpty()]
@developerprofiles
developerprofiles / Get-ADChange.ps1
Created June 14, 2021 17:30 — forked from jdhitsolutions/Get-ADChange.ps1
A PowerShell function and custom format file for displaying changed objects in Active Directory.
#requires -version 5.1
#requires -module ActiveDirectory
# Learn more about PowerShell: http://jdhitsolutions.com/blog/essential-powershell-resources/
Function Get-ADChange {
[cmdletbinding()]
[outputtype("ADChange")]
[alias("gadc")]
@developerprofiles
developerprofiles / Get-ADUserAudit.ps1
Created June 14, 2021 17:30 — forked from jdhitsolutions/Get-ADUserAudit.ps1
A PowerShell function and format file for getting Active Directory user management events from the security event logs on domain controllers.
#requires -version 5.1
#requires -module ActiveDirectory
#you might need to increase the size of the Security eventlog
# limit-eventlog -LogName security -ComputerName dom2,dom1 -MaximumSize 1024MB
Function Get-ADUserAudit {
[cmdletbinding()]
Param(
[Parameter(Position=0,HelpMessage = "Specify one or more domain controllers to query.")]
@developerprofiles
developerprofiles / Get-PSProcess.ps1
Created June 14, 2021 17:29 — forked from jdhitsolutions/Get-PSProcess.ps1
Get all PowerShell or pwsh processes running on your computer.
#requires -version 5.1
#requires -module CIMCmdlets
Function Get-PSPowerShell {
<#
.Synopsis
Get all PowerShell processes.
.Description
Get all PowerShell or pwsh processes on your computer. The command will default
to the same PowerShell process as your console, but you can specify either one.
@developerprofiles
developerprofiles / Get-EventCountdown.ps1
Created June 14, 2021 17:29 — forked from jdhitsolutions/Get-EventCountdown.ps1
A PowerShell function to display an event countdown.
#requires -version 5.1
Function Get-EventCountdown {
[cmdletbinding()]
[OutputType("PSCountdown")]
Param(
[Parameter(Position=0,Mandatory,ValueFromPipeline,ValueFromPipelineByPropertyName,HelpMessage = "Enter the event date and time.")]
[ValidateNotNullOrEmpty()]
[ValidateScript({
if ($_ -ge (Get-Date)) {
@developerprofiles
developerprofiles / Get-Restart.ps1
Created June 14, 2021 17:29 — forked from jdhitsolutions/Get-Restart.ps1
A PowerShell function and format file to query the event log using Get-WinEvent for restart related events.
Function Get-Restart {
[cmdletbinding()]
[outputtype("RestartEvent")]
Param(
[Parameter(Position = 0, ValueFromPipeline)]
[ValidateNotNullOrEmpty()]
[Alias("CN")]
[string]$Computername = $env:COMPUTERNAME,
[Parameter(HelpMessage = "Find restart events since this date and time.")]
[ValidateNotNullOrEmpty()]
@developerprofiles
developerprofiles / Get-DockerContainer.ps1
Created June 3, 2021 13:50 — forked from jdhitsolutions/Get-DockerContainer.ps1
A PowerShell function to get docker containers as objects.
#requires -version 5.1
Function Get-DockerContainer {
[cmdletbinding(DefaultParameterSetName = "name")]
[alias("gdc")]
[OutputType("Get-DockerContainer.myDockerContainer")]
Param(
[Parameter(Position = 0, HelpMessage = "Enter a docker container name. The default is all running containers.", ParameterSetName = "name")]
[ValidateNotNullorEmpty()]
@developerprofiles
developerprofiles / downloadTerraform.ps1
Created May 27, 2021 14:38 — forked from rchaganti/downloadTerraform.ps1
Download and Install Terraform - Windows (PowerShell)
[CmdletBinding(DefaultParameterSetName='Version')]
param
(
[Parameter(ParameterSetName='Latest', Mandatory = $true)]
[Parameter(ParameterSetName='Version', Mandatory = $true)]
[String]
$SaveToPath,
[Parameter(ParameterSetName='Version', Mandatory = $true)]
[String]