This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Install-Module PSHTMLTools |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $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>.*)" { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Get-ADUser martin9700 -properties LockedOut |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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'. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [CmdletBinding()] | |
| Param ( | |
| [ValidateScript({ Test-Path $_ } )] | |
| [string]$Path = "c:\Test" | |
| ) | |
| $ResultHash = @{ | |
| "1-0" = 0 | |
| "0-1" = 0 | |
| "1/2-1/2" = 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Get-VM | | |
| Get-View | | |
| Select @{Name="OS";Expression={ $_.Summary.Config.GuestFullName }} | | |
| Group OS | | |
| Sort Name | | |
| Select Name,@{Name="Total VMs";Expression={ $_.Count }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # $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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $ErrorHandlerScript = { | |
| Param( | |
| $Sender, | |
| $Event | |
| ) | |
| $Message.Add([PSCustomObject]@{ | |
| Number = $Event.Errors.Number | |
| Line = $Event.Errors.LineNumber | |
| Message = $Event.Errors.Message |
NewerOlder