This file contains 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 Init { | |
$File = "$env:tmp\testfile.tmp" | |
if(-Not (Test-Path -Path $File)){[Void](New-Item -Path $File -Type File)} | |
Start-Service -Name Spooler | |
} | |
Function Validate { | |
$File = "$env:tmp\testfile.tmp" | |
$FileStatus = if(Test-Path -Path $File){'Exists'}else{'Removed'} | |
$SrvStatus = (Get-Service -Name Spooler).Status |
This file contains 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
# Oneliner: | |
Invoke-RestMethod -Uri http://telize.com/geoip | Select-Object -Property longitude, latitude, continent_code, timezone | |
# Advanced function: | |
Function Get-GeoInformation | |
{ | |
<# | |
.Synopsis | |
Get geo information for current IP address or | |
any specified IP address. |
This file contains 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(DefaultParameterSetName='Default')] | |
param | |
( | |
[Parameter(ParameterSetName = 'Default', | |
Mandatory=$true, | |
Position = 0)] | |
[String[]]$Word, | |
[Parameter(ParameterSetName = 'Default', | |
Position = 1)] |
This file contains 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
Verifying that +simonwahlin is my blockchain ID. https://onename.com/simonwahlin |
This file contains 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 Test { | |
[cmdletbinding()] | |
param( | |
[Parameter(Mandatory=$true,Position=1)] | |
[string]$smtpServer, | |
[Parameter(Position=2)] | |
[switch]$logging, | |
[Parameter(Position=4)] |
This file contains 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
#!C:\Program\ Files\PowerShell\6.0.0\pwsh.exe -File | |
$Pattern = '^origin\s+https://(\S+)\s\(push\)' | |
$Origin = (& 'git' 'remote' '-v') -match $Pattern | Where-Object -FilterScript {$_ -is [string]} | |
$RemoteDomain = if($Origin -match $Pattern) {$Matches[1]} | |
$Email = & 'git' 'config' '--get' 'user.email' | Where-Object -FilterScript {$_ -is [string]} | |
$DesiredEmail = switch -Wildcard ($RemoteDomain) { | |
'simonwahlin.visualstudio.com*' { | |
'[email protected]' | |
break |
This file contains 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 | |
Change language settings for a PowerPoint presentation | |
.EXAMPLE | |
PS> Set-PowerPointLanguage -Path MyPres.pptx | |
Writes a copy of MyPres.pptx to MyPres.en-us.pptx with the language set to 'en-US' - English (the default) | |
.EXAMPLE | |
PS> Set-PowerPointLanguage -Path MyPres.pptx -Language de-DE |
This file contains 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 Send-PSNotification { | |
[cmdletbinding()] | |
param( | |
[Parameter(Mandatory,ValueFromPipeline,Position=0)] | |
[object] | |
$Body, | |
[String] | |
$Summary = 'PowerShell Notification', |
This file contains 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 Send-PSNotification { | |
[cmdletbinding()] | |
param( | |
[Parameter(Mandatory,ValueFromPipeline,Position=0)] | |
[object] | |
$Body, | |
[String] | |
$Summary = 'PowerShell Notification', |
This file contains 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 -Version 4.0 | |
<# | |
Author: Luke Murray (Luke.Geek.NZ) | |
Version: 0.1 | |
Purpose: Windows 10 Baseline Hardening using DSC per DoD DISA STIG recommendations 22/06/18. | |
Modified to include comments explaining config by Frankie McDonough 01/23/19. | |
#> | |
Configuration 'Win10' | |
{ |
OlderNewer