Skip to content

Instantly share code, notes, and snippets.

Avatar

Clint Colding clintcolding

View GitHub Profile
@clintcolding
clintcolding / AppPoolTasks.ps1
Created Nov 20, 2019
Perform various IIS App Pool tasks via PowerShell
View AppPoolTasks.ps1
#---- Recycles all application pools on the given computer ----#
function RecyclePool {
[CmdletBinding()]
param (
[string[]]$ComputerName,
[pscredential]$Credential
)
process {
foreach ($server in $ComputerName) {
View whoami-compose.yml
version: '3'
services:
whoami:
image: stefanscherer/whoami
labels:
# Create a router called whoami listening on the websecure entrypoint
- "traefik.http.routers.whoami.entrypoints=websecure"
# Force TLS
- "traefik.http.routers.whoami.tls=true"
View traefik-compose.yml
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
View certs-traefik.yml
tls:
certificates:
- certFile: /etc/certs/examplecert.crt
keyFile: /etc/certs/examplecert.key
@clintcolding
clintcolding / rpisshkeys
Created Jul 9, 2019
Configure Raspberry Pi SSH Keys
View rpisshkeys
#---- Create key on client ----#
ssh-keygen -b 2048 -t rsa
#---- Validate creation ----#
ls ~/.ssh
#---- SSH to Pi and create the SSH directory and file ----#
mkdir .ssh
cd .ssh
touch authorized_keys
@clintcolding
clintcolding / GetIISandNonPagedMem.ps1
Created Feb 18, 2019
Gets Windows server resource usage
View GetIISandNonPagedMem.ps1
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 / SyncTimeWithHost.ps1
Created Jan 30, 2019
Sync VM time with VMware host.
View SyncTimeWithHost.ps1
$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 / VMware-StartConnected.ps1
Created Jan 30, 2019
Set VMware VM's network adapters to start connected.
View VMware-StartConnected.ps1
$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 / useful_core_scripts.ps1
Created Nov 7, 2018
Useful commands for Windows Core OS.
View useful_core_scripts.ps1
#--- 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 / bluecatscripts.ps1
Created Jul 24, 2018
Bluecat/Proteus API PowerShell Scripts
View bluecatscripts.ps1
# API Documentation can be at http://timlossev.com/attachments/Proteus_API_Guide_3.7.1.pdf
# Connecting the the API
$credential = Get-Credential
$uri = "http://bluecatserver/Services/API?wsdl"
$bc = New-WebServiceProxy -Uri $uri
$bc.CookieContainer = New-Object System.Net.CookieContainer
$bc.login($Credential.UserName, ($Credential.GetNetworkCredential()).Password)
# Find IP based on assigned name in Bluecat