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
| Remove-Item Alias:wget | |
| Remove-Item Alias:curl |
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
| Set-PSReadlineKeyHandler -Key ctrl+d -Function DeleteCharOrExit |
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 cl { | |
| Param( | |
| $Location | |
| ) | |
| try { | |
| Set-Location $Location -ErrorAction Stop | |
| Get-ChildItem | |
| } catch { | |
| throw $_ |
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
| # Check for Administrator elevation | |
| $wid = [System.Security.Principal.WindowsIdentity]::GetCurrent() | |
| $prp = new-object System.Security.Principal.WindowsPrincipal($wid) | |
| $adm = [System.Security.Principal.WindowsBuiltInRole]::Administrator | |
| $IsAdmin = $prp.IsInRole($adm) | |
| if ($IsAdmin) { | |
| $Host.UI.RawUI.BackgroundColor = "DarkRed" | |
| Clear-Host | |
| Write-Host "`n`tWarning: PowerShell is running as an Administrator.`n" |
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
| $host.UI.RawUI.WindowTitle = "$(($ENV:USERNAME).tolower())@localhost - $(Get-Location)" |
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
| $HHUrl = "http://happyhour.virginaustralia.com/sale-on" | |
| $page = Invoke-WebRequest -Uri $HHUrl | |
| $flightDivs = $page.ParsedHtml.body.getElementsByClassName('card-flight') | |
| foreach ($flightDiv in $flightDivs) { | |
| New-Object -TypeName PSObject -Property @{ | |
| "From" = $flightDiv.getElementsByTagName("h3")[0].innerText.Split("`n")[0].Trim() -replace '\ to', '' |
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 UpdateImplicitRemotingHandler { | |
| $modules = Get-Module tmp_* | |
| foreach ($module in $modules) | |
| { | |
| [bool]$moduleProcessed = $false | |
| [string] $moduleUrl = $module.Description | |
| [int] $queryStringIndex = $moduleUrl.IndexOf("?") |
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
| foreach ($sku in (Get-MsolAccountSku) ) { | |
| foreach ($sp in $sku.ServiceStatus) { | |
| New-Object -TypeName PSObject -Property @{"AccountSkuId"=$sku.AccountSkuId;"ServicePlan"=$sp.ServicePlan.ServiceName} | |
| } | |
| } |
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
| $allDistributionGroups = Get-DistributionGroup -ResultSize unlimited | |
| $allGroupMemberships = $allDistributionGroups | ForEach-Object { | |
| $thisGroup = $_ | |
| Get-DistributionGroupMember -Identity $thisGroup.Identity | | |
| Select-Object ` | |
| @{Name="GroupIdentity";Expression={$thisGroup.primarySmtpAddress}}, | |
| @{Name="MemberAddress";Expression={$_.PrimarySmtpAddress}} | |
| } |
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
| $articleRoot = "articles" | |
| $tocFileTypes = @("md") | |
| function CreateTocForFolder { | |
| Param( | |
| [String]$Path | |
| ) | |
| # First, create a toc for child folders |