Skip to content

Instantly share code, notes, and snippets.

View clintcolding's full-sized avatar

Clint Colding clintcolding

View GitHub Profile
@clintcolding
clintcolding / apiheader
Created November 29, 2017 17:11
GoDaddy API Auth Header
$apiKey = '2s7Yn1f2dW_W5KJhWbGwuLhyW4Xdvgb2c'
$apiSecret = 'oMmm2m5TwZxrYyXwXZnoN'
$Headers = @{}
$Headers["Authorization"] = 'sso-key ' + $apiKey + ':' + $apiSecret
C:\> Invoke-WebRequest https://api.godaddy.com/v1/domains/clintcolding.com/records/ -Method Get -Headers $Headers
StatusCode : 200
StatusDescription : OK
Content : [{"type":"A","name":"@","data":"192.30.252.153","ttl":600},{"type":"A","name":"@","data":"19
2.30.252.154","ttl":600},{"type":"CNAME","name":"email","data":"email.secureserver.net","ttl
":3600},{"type":...
RawContent : HTTP/1.1 200 OK
Access-Control-Allow-Credentials: true
Vary: Origin,Accept-Encoding
C:\> Invoke-WebRequest https://api.godaddy.com/v1/domains/clintcolding.com/records/ -Method Get -Headers $Headers | ConvertFrom-Json
type name data ttl
---- ---- ---- ---
A @ 192.30.252.153 600
A @ 192.30.252.154 600
CNAME email email.secureserver.net 3600
CNAME ftp @ 3600
CNAME www @ 3600
CNAME _domainconnect _domainconnect.gd.domaincontrol.com 3600
@clintcolding
clintcolding / useful_core_scripts.ps1
Created November 7, 2018 20:54
Useful commands for Windows Core OS.
#--- Create New Volume ---#
Get-Disk | Where partitionstyle -eq 'raw' |
Initialize-Disk -PartitionStyle MBR -PassThru |
New-Partition -AssignDriveLetter -UseMaximumSize |
Format-Volume -FileSystem NTFS -NewFileSystemLabel "disk2" -Confirm:$false
#--- Expand Disk ---#
$servers = "myserver1","myserver2"
@clintcolding
clintcolding / VMware-StartConnected.ps1
Created January 30, 2019 20:35
Set VMware VM's network adapters to start connected.
$vms = Get-VM
foreach ($vm in $vms) {
if (($adapter = $vm | Get-NetworkAdapter).ConnectionState.StartConnected -ne "True") {
$adapter = $adapter | Set-NetworkAdapter -StartConnected:$true -Confirm:$false
}
[PSCustomObject]@{
Name = $vm.Name
StartConnected = $adapter.ConnectionState.StartConnected
}
@clintcolding
clintcolding / SyncTimeWithHost.ps1
Created January 30, 2019 20:45
Sync VM time with VMware host.
$vms = Get-VM "DQWBATMAN01SRV" | Get-View
foreach ($vm in $vms) {
if ($vm.Config.Tools.SyncTimeWithHost -eq $false) {
$vmConfig = New-Object VMware.Vim.VirtualMachineConfigSpec
$vmConfig.Tools = New-Object VMware.Vim.ToolsConfigInfo
$vmConfig.Tools.SyncTimeWithHost = $true
$vm.ReconfigVM($vmConfig)
}
[PSCustomObject]@{
@clintcolding
clintcolding / GetIISandNonPagedMem.ps1
Created February 18, 2019 15:49
Gets Windows server resource usage
Invoke-Command -ComputerName $server -Credential $cred {
$npmem = Get-Counter -Counter "\Memory\Pool Nonpaged Bytes" -MaxSamples 1 -SampleInterval 1
[PSCustomObject]@{
Hostname = $env:COMPUTERNAME
"w3wp(MB)" = [math]::Round((Get-Process w3wp | Measure-Object WorkingSet -Sum).sum / 1MB,2)
"NonPaged(GB)" = [math]::Round($npmem.CounterSamples.cookedvalue / 1gb,2)
}
}
@clintcolding
clintcolding / AppPoolTasks.ps1
Created November 20, 2019 18:40
Perform various IIS App Pool tasks via PowerShell
#---- Recycles all application pools on the given computer ----#
function RecyclePool {
[CmdletBinding()]
param (
[string[]]$ComputerName,
[pscredential]$Credential
)
process {
foreach ($server in $ComputerName) {
@clintcolding
clintcolding / traefik-compose.yml
Created November 6, 2019 19:36
Traefik example
version: '3'
services:
reverse-proxy:
# The official v2.0 Traefik docker image
image: traefik:v2.0
command:
- --api.insecure=true
- --providers.docker
- --providers.file.directory=/etc/traefik/dynamic
@clintcolding
clintcolding / certs-traefik.yml
Last active February 3, 2021 21:22
Traefik example
tls:
certificates:
- certFile: /etc/certs/examplecert.crt
keyFile: /etc/certs/examplecert.key