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
# 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
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
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
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
New-Object -TypeName PSObject -Property @{Message="Hello, again!"} |
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 Invoke-Gist { | |
Param( | |
[String] | |
$Identity, | |
[String] | |
$Arguments | |
) | |
$gistBase = "https://api.github.com/gists/" |
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
param( | |
[String] | |
$Path, #the path to the files to be uploaded | |
[String] | |
$siteUrl, #this is the URL of the Group in the format https://contoso.sharepoint.com/sites/yourGroupName | |
[String] | |
$listName = "Shared Documents" | |
#this is the path within the site to the place where you want to put the files |
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
$CameraIp = "192.168.0.10" | |
$DateFrom = Get-Date "29 December 2017" | |
function Invoke-OLApiCommand { | |
Param( | |
[String]$Command, | |
[String]$Arguments | |
) | |
$CommandVerb = $Command.Split("_")[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
$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', '' |