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
## Hey folks, this is just a quick walkthrough on modifying the trusted hosts property in WSMAN using Powershell | |
# By default PowerShell loads a PSDrive for the WinRM service | |
# We modify the trusted hosts property using the Set-Item cmdlet | |
Set-Item WSMan:\localhost\Client\TrustedHosts -value 192.168.1.13 | |
#This sets the value to 192.168.1.13, it also overwrites any existing values | |
# If you want to set a subnet you can use the PowerShell wildcard character | |
Set-Item WSMan:\localhost\Client\TrustedHosts -value 192.168.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
This gist simply covers using a DSC configuration to configure an endpoint. | |
Load the DSC resource like any other function. | |
1. You can copy and paste the Configuration into a powershell console | |
2. You can dot source the script containing the configuration | |
EX: . c:\scripts\DSCConfiguration.ps1 | |
Note - there are other ways as well but I have limited time... | |
Call the configuration by it's name and supply any parameters you need | |
Ex: CustomConfig -computername Host1 -outputpath c:\temp |
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 Set-EnvVariable | |
{ | |
<# | |
.SYNOPSIS | |
Sets the value of an environment variable | |
.DESCRIPTION | |
This function will set the value of an environment variable. The default behavior is to overwrite the existing value. The concatenate switch will append the new value to the existing value. | |
.EXAMPLE | |
Set-EnvVariable -Name Path -Value C:\git -Concatenate | |
Adds, ";c:\git" to the path variable |
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 Get-OneDriveUrl { | |
param ( | |
$sharingUrl | |
) | |
$base64Value = [System.Convert]::ToBase64String( [System.Text.Encoding]::UTF8.GetBytes($sharingUrl) ) | |
$encodedUrl = "u!" + $base64Value.TrimEnd('=').Replace('/','_').Replace('+','-') | |
(Invoke-RestMethod -Uri "https://api.onedrive.com/v1.0/shares/$encodedUrl/root?expand=children").'@content.downloadUrl' | |
} |
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
Thu Apr 20 23:03:31 UTC 2017 |
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
enum bump { | |
Major | |
Minor | |
Patch | |
} | |
function Update-CookbookVersion { | |
param ( | |
[string]$path, | |
[bump]$bump = 'Patch' |
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
$x = New-Object -COM WScript.Shell | |
Do | |
{ | |
$x.SendKeys('{NUMLOCK}{NUMLOCK}') | |
Start-Sleep -Seconds 600 | |
} | |
Until ($false) |
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
start-job -ScriptBlock {Update-Help -Force} | Out-Null | |
function ql { $args } | |
function qs { "$args" } | |
$Host.PrivateData.ErrorForegroundColor = 'magenta' | |
$Host.PrivateData.VerboseForegroundColor = 'cyan' | |
$host.ui.RawUI.WindowTitle = "Jason`'s Rocking PowerShell Console: $([Math]::Round((Get-Process -id $PID).WorkingSet/1mb,2)) MB Memory used" | |
function prompt { | |
$Branch = Get-GitBranch | |
if (! $Branch) { | |
"$((hostname).split('.')[0]):$(("$($PWD.path)" -replace $HOME,'~').split('/')[-1]) $ENV:USER $('>' * ($nestedPromptLevel + 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
#requires curl | |
function grab-stories { | |
param ($username) | |
(curl -sL http://api.storify.com/v1/stories/$username | | |
ConvertFrom-Json).content.stories.foreach{curl -s -o "$($_.slug).html" "$($_.permalink)"} | |
} |
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
{ | |
"Working Directory" : "\/Users\/jason", | |
"Prompt Before Closing 2" : 0, | |
"Selected Text Color" : { | |
"Green Component" : 0, | |
"Red Component" : 0, | |
"Blue Component" : 0 | |
}, | |
"Rows" : 25, | |
"Ansi 11 Color" : { |
OlderNewer