Skip to content

Instantly share code, notes, and snippets.

View martin9700's full-sized avatar
💭
Updated Set-CellColor -- CICD built too. Now need to make a module out of this.

MartinPugh martin9700

💭
Updated Set-CellColor -- CICD built too. Now need to make a module out of this.
View GitHub Profile
Install-Module PSHTMLTools
Context "Domain Replication" {
$ReplErrors = Get-ADReplicationPartnerMetadata -Target * -Partition *
It "Last Replication Result" {
$ReplErrors | Measure-Object -Property LastReplicationResult -Sum | Select -ExpandProperty Sum | Should Be 0
}
It "Consecutive Replication Failures" {
$ReplErrors | Measure-Object -Property ConsecutiveReplicationFailures -Sum | Select -ExpandProperty Sum | Should Be 0
}
}
$Tests = @(
"Running partition tests on : ForestDnsZones"
"Running enterprise tests on : domain.surlyadmin.com"
)
ForEach ($Line in $Tests)
{
Switch ($_) -Regex
{
"running (?<Zone>partition|enterprise) tests on : (?<PartTest>.*)" {
#Define Quarters
$Quarters = @{}
$Start = Get-Date -Month 1 -Date 1 -Year (Get-Date).Year
ForEach ($Q in (1..4))
{
$Quarters.Add($Q,[PSCustomObject]@{
From = $Start
To = $Start.AddMonths(3).AddTicks(-1)
})
$Start = $Start.AddMonths(3)
Get-ADUser martin9700 -properties LockedOut
VERBOSE: Loading module from path 'C:\testsql\testsql.psd1'.
VERBOSE: Loading module from path 'C:\testsql\TestSQL.psm1'.
VERBOSE: Exporting function 'Get-Size'.
VERBOSE: Exporting function 'Get-SQLDate'.
VERBOSE: Exporting function 'Get-SQLTime'.
VERBOSE: Exporting function 'ValidateAGClusterObject'.
VERBOSE: Exporting function 'Get-AGCluster'.
VERBOSE: Exporting function 'Get-AGDatabaseState'.
VERBOSE: Exporting function 'Get-AGReplicaState'.
[CmdletBinding()]
Param (
[ValidateScript({ Test-Path $_ } )]
[string]$Path = "c:\Test"
)
$ResultHash = @{
"1-0" = 0
"0-1" = 0
"1/2-1/2" = 0
Get-VM |
Get-View |
Select @{Name="OS";Expression={ $_.Summary.Config.GuestFullName }} |
Group OS |
Sort Name |
Select Name,@{Name="Total VMs";Expression={ $_.Count }}
# $Message was the variable where I stored the message information
ForEach ($Warning in ($Message | Where Number -eq 0))
{
If ($PrintToStdOut)
{
Write-Output $Warning.Message
}
Else
{
Write-Verbose $Warning.Message -Verbose
$ErrorHandlerScript = {
Param(
$Sender,
$Event
)
$Message.Add([PSCustomObject]@{
Number = $Event.Errors.Number
Line = $Event.Errors.LineNumber
Message = $Event.Errors.Message