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
$QuakesData = Invoke-RestMethod -uri "http://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/4.5_month.geojson"
[array]$Locations = ForEach ($Quake in ($QuakesData.Features | Select -First $Quakes))
{ [PSCustomObject]@{
Title = $Quake.properties.place
Magnitude = $Quake.properties.mag
TimeDate = [timezone]::CurrentTimeZone.ToLocalTime(([datetime]'1/1/1970').AddMilliseconds($Quake.properties.time))
Lon = $Quake.geometry.coordinates[0]
Lat = $Quake.geometry.coordinates[1]
}
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)
$Dir = "c:\dropbox"
$RoboCopyList = Invoke-Expression -Command "Robocopy $Dir NULL /L /S /NJH /NJS /BYTES /FP /NC /NDL /XJ /TS /R:0 /W:0"
ForEach ($File in $RoboCopyList)
{ If ($File -match "(?<Size>\d+)\s(?<Date>\S+\s\S+)\s+(?<Folder>\S+)\\(?<Name>.*$)")
{ [PSCustomObject]@{
Name = $Matches.Name
Size = [int32]$Matches.Size
LastWriteTime = [datetime]$Matches.Date
}
}
Get-ADUser martin9700 -properties LockedOut
<div id="Chart0"></div>
Date Frogs Eagles Pigs
1/10 10 35 4
1/11 3 44 8
1/12 8 12 12
1/13 1 2 3
1/14 13 35 10
1/15 18 44 22
$Header = @"
<style>
H1 {color: #000099;}
TABLE {border-width: 1px;border-style: solid;border-color: black;border-collapse: collapse; clear:both;}
TH {border-width: 1px;padding: 3px;border-style: solid;border-color: black;background-color: #6495ED;font-size:1.5em;}
TD {border-width: 1px;padding: 3px;border-style: solid;border-color: black;}
DIV {float: left;}
</style>
$($Chart1.jscript)
$($Chart2.jscript)