Loop | Return | Continue | Break |
---|---|---|---|
Normal Expectation | Exit Scope | Next Item | Exit Loop |
.foreach{} | Next Item | Break Scopes / Next Item of Parent Loop | Break Scopes / Exit Parent Loop |
foreach ($y in $x) | Exit Scope | Next Item | Exit Loop |
for ($i;$i -lt 5;$i++) | Exit Scope | Next Item | Exit Loop |
Foreach-Object -InputObject @() | Next Item | Break Scopes / Next Item of Parent Loop | Break Scopes / Exit Parent Loop |
Switch | Exit Scope | Next Item | Exit Switch |
While |
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
############################################################################################################################################################## | |
# IANA # | |
############################################################################################################################################################## | |
# | |
# Address family | |
# | |
New-Enum -ModuleBuilder $IndentedDnsMB -Name "Indented.Dns.IanaAddressFamily" -Type "UInt16" -Members @{ | |
IPv4 = 1; # IP version 4 |
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
#requires -module ExchangeOnlineManagement,ThreadJob | |
function Start-ExchangeThreadJob { | |
<# | |
.SYNOPSIS | |
Works like Start-Threadjob but for Exchange and preserves the exchange state | |
.NOTES | |
This works because the new REST commands are basically CLIXML proxies via a REST API. A dynamic module is generated upon | |
connection to the exchange server, and it has the session context and token "hard coded" into the module. | |
By simply bringing this module into the runspace, it shares the same context and token. | |
#> |
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
using namespace Microsoft.Exchange.Management.AdminApiProvider | |
using namespace Microsoft.Exchange.Management.ExoPowershellSnapin | |
using namespace System.Collections.Generic | |
using namespace System.Net.Http | |
using namespace System.Net.Http.Headers | |
using namespace System.Threading. | |
<# | |
I made this as a way to overcome some limitations with very complicated filter queries that exceed the REST limit, while being able to run them in parallel without resorting to runspaces | |
#> |
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
function Get-DNSDebugLog | |
{ | |
<# | |
.SYNOPSIS | |
This cmdlet parses a Windows DNS Debug log with details. | |
Author: @jarsnah12 | |
License: BSD 3-Clause | |
Required Dependencies: None | |
Optional Dependencies: None |
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
# Import-Module .\assemblies\PSHTML\PSHTML.psd1 | |
html -Content { | |
head -Content { | |
Title -Content "iCMS | Home" | |
Link -href "./../assets/css/metro.min.css" -rel "stylesheet" | |
Link -href "./../assets/css/metro-colors.min.css" -rel "stylesheet" | |
Link -href "./../assets/css/metro-rtl.min.css" -rel "stylesheet" | |
Link -href "./../assets/css/metro-icons.min.css" -rel "stylesheet" | |
script -src "./../assets/js/jquery-3.3.1.min.js" | |
script -src "./../assets/js/metro.min.js" |
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
# in module scope | |
$script:pester | |
function describe () { | |
$script:pester.EnterBlock("describe") | |
} | |
function it () { |
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
using Namespace System.Management.Automation.Language | |
Function Get-AliasTarget { | |
[cmdletbinding()] | |
param ( | |
[Parameter(Mandatory, ValueFromPipeline, ValueFromPipelineByPropertyName)] | |
[Alias('PSPath', 'FullName')] | |
[string[]]$Path | |
) |
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
function Save-WebCertificate { | |
param ( | |
# Attempt to acquire a certificate from the specified URI | |
[Parameter(Mandatory)] | |
[ValidateScript( { $_.Scheme -eq 'https' } )] | |
[Uri]$Uri, | |
# Save the certificate in PEM format to the specified path. | |
[Parameter(Mandatory)] | |
[String]$Path, |
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
<# | |
.SYNOPSIS | |
Get the latest Cumulative update for Windows | |
.DESCRIPTION | |
This script will return the list of Cumulative updates for Windows 10 and Windows Server 2016 from the Microsoft Update Catalog. | |
.NOTES | |
Copyright Keith Garner ([email protected]), All rights reserved. |
NewerOlder