Skip to content

Instantly share code, notes, and snippets.

View ryancbutler's full-sized avatar

Ryan Butler ryancbutler

View GitHub Profile
#!/usr/bin/env python
import json, requests, base64, sys, os, re, socket
slack_url = "https://hooks.slack.com/services/###MYKEYHERE#####"
def main():
consul_stdin = json.load(sys.stdin)
getSVCStatus(consul_stdin)
@ryancbutler
ryancbutler / citrix-ingress.yml
Last active November 30, 2018 16:26
citrix-ingress.yml
---
kind: Namespace
apiVersion: v1
metadata:
name: citrix
labels:
name: citrix
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1beta1
# Calico Version v3.3.1
# https://docs.projectcalico.org/v3.3/releases#v3.3.1
# This manifest includes the following component versions:
# calico/node:v3.3.1
# calico/cni:v3.3.1
# This ConfigMap is used to configure a self-hosted Calico installation.
kind: ConfigMap
apiVersion: v1
metadata:
Write-Verbose "Starting VM Tools Installs" -Verbose
$UnattendedArgs = '/S /v /qn REBOOT=R'
$filepath = "$($env:SystemRoot)\temp\"
$url = "https://packages.vmware.com/tools/esx/latest/windows/x64/"
$link = invoke-webrequest $url -SessionVariable mysession
$link = $link.Links|Where-Object{$_.innerHTML -like "VMware*"}
$filename = ($link.href).Replace("x64/","")
Invoke-WebRequest -Uri ($url + $filename) -WebSession $mysession -OutFile "$filepath\$filename"
@ryancbutler
ryancbutler / RunJenkins.ps1
Created August 6, 2018 13:54
Build Jenkins Job PS
$JenkinsURL = "192.168.4.20:8080/"
$JobName = "UpgradeDesktop"
$Username = "rbutler"
$Token = ""
$full = "http://" + $jenkinsurl + "/job/" + $jobname + "/build"
$base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f $username,$token)))
$ParamsJSON = ConvertTo-Json -InputObject $JenkinsParams
Invoke-RestMethod -uri $Full -Method POST -Body @{ json = $ParamsJSON } -Headers @{Authorization=("Basic {0}" -f $base64AuthInfo)}
$image = Get-ALimage -websession $websession|where{$_.name -eq "Accounting Win10"}
$imagedetail = Get-ALimagedetail -websession $websession -id $image.id
$osrev = $imagedetail.OsRev.Revisions.RevisionResult
$myimage = New-Object -TypeName PSObject
#Operating System
$OS = [PSCustomObject]@{
NAME = $imagedetail.OsRev.name
ID = $imagedetail.OsRev.Revisions.RevisionResult.Id
IMAGEID = $imagedetail.OSrev.ImageId
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
Enable-Psremoting -force -SkipNetworkProfileCheck
choco install -y git -params '"/GitOnlyOnPath"'
Install-PackageProvider -Name NuGet -Force
find-module -Repository PSGallery -Name PowerShellGet | Install-Module -Force
find-module -Repository PSGallery -Name PSScriptAnalyzer | Install-Module -Force
find-module -Repository PSGallery -Name Pester | Install-Module -Force -SkipPublisherCheck
Find-Module -Name xComputerManagement -Repository PSGallery | Install-Module -Force
Find-Module -Name xRemoteDesktopAdmin -Repository PSGallery | Install-Module -Force
Find-Module -Name xWinRm -Repository PSGallery | Install-Module -Force
$sb = {
<#
.Synopsis
Here is the PowerShell CmdLet that would enable AutoLogon next time when the server reboots.We could trigger a specific Script to execute after the server is back online after Auto Logon.
The CmdLet has the follwing parameter(s) and function(s).
-DefaultUsername : Provide the username that the system would use to login.
-DefaultPassword : Provide the Password for the DefaultUser provided.
-AutoLogonCount : Sets the number of times the system would reboot without asking for credentials.Default is 1.
-Script : Provide Full path of the script for execution after server reboot. Example : c:\test\run.bat
version: '2'
services:
cpx:
image: store/citrix/netscalercpx:12.0-56.20
tty: true
ports:
- "8888:8888" #VIP Port to be used
- "8080:80" #NSIP Mapping HTTP
- "8443:443" #NSIP Mapping HTTPS
- "8022:22" #NSIP Mapping SSH
#RUN AS ADMIN. WILL ERROR OUT ON CONNECTION
CLS
#SET TLS 1.2
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Function Get-StringHash([String] $String,$HashName = "MD5")
{
$StringBuilder = New-Object System.Text.StringBuilder
[System.Security.Cryptography.HashAlgorithm]::Create($HashName).ComputeHash([System.Text.Encoding]::UTF8.GetBytes($String))|%{