Skip to content

Instantly share code, notes, and snippets.

View jkavanagh58's full-sized avatar

John J Kavanagh jkavanagh58

View GitHub Profile
@lwsrbrts
lwsrbrts / DCReplicationPesterTest.ps1
Created July 23, 2018 14:41
A pester test to check domain controller replications, grouping by source DC. Obviously requires repadmin.
Describe 'Domain Controllers' {
Context 'Replication Link Status' {
$results = repadmin /showrepl * /csv | ConvertFrom-Csv # Get the results of all replications between all DCs
$groups = $results | Group-Object -Property 'Source DSA' # Group the results by the source DC
foreach ($sourcedsa in $groups) {
# Create a context for each source DC
@bgelens
bgelens / errorvariablemock.ps1
Created June 7, 2018 13:35
Have ErrorVariable populated through a Mock
Mock -CommandName Get-SomeCommand -MockWith {
param (
$ErrorVariable
)
$errorRecord = [System.Management.Automation.ErrorRecord]::new(
[System.Exception]::new('Failed!'),
'Error',
[System.Management.Automation.ErrorCategory]::InvalidOperation,
$null
)