Skip to content

Instantly share code, notes, and snippets.

Working from home

Nick Shores nshores

Working from home
Block or report user

Report or block nshores

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View restart-service.ps1
#define list of computers, this is just a simple array but you could also feed it a csv with
# $computers = import-csv 'yourcsvname.csv'
$computers = ‘pkw7-erice’,’pkw7-test’
foreach ($c in $computers){
#stop Service
write-host "Stopping Kace service on $c"
get-service -ComputerName $c | ? {$_.Name -like "*konea*"} | Set-Service -Status stopped
#start service
write-host "Starting Kace service on $c"
View gist:ce3dd558df557ff3b1209aff6f440ee0
Steps for X11 forwarding with OSX -
Install Xquartx with Homebrew --
brew cask install xquartz
Set preferences for xquartz
open -a XQuartz. In the XQuartz preferences, go to the “Security” tab and make sure you’ve got “Allow connections from network clients” ticked:
Use xhost on remote machine to allow access to local client for x11 forwarding
xhost + (SSH client ip)
Set env variable on remote machine to local ssh client ip
nshores /
Last active Oct 8, 2018
#Reboot receiver when eISCP commands fail
import eiscp
import requests
import time
import urllib
from influxdb import InfluxDBClient
#Define influxdb stuff
nshores /
Last active Jul 18, 2018
#Pyhton to couchpotato API
import requests
from pprint import pprint
import json
#Get the data
data = requests.get("http://slimleech:5001/api/556033fe3c9b4a1caf6fcbed6fd2f66a/media.list")
binary = data.content
output = json.loads(binary)
#Backup databases
echo Backing up databases
sudo mysql -Ns -e"SHOW DATABASES" > ~/db_list.txt
mkdir ~/db_backup/
cat ~/db_list.txt | while read i
echo Backing up $i
do sudo mysqldump "$i" > ~/db_backup/"$i".sql
View new_ad_user.ps1
$content = Import-Csv 'c:\test.csv'
foreach ($user in $content){
New-ADUser -Enabled $True -AccountPassword (ConvertTo-SecureString aiwhc321 -AsPlainText -force) -name $user."Display Name" `
-homeDirectory $user."Home Directory" `
-homedrive $user."Home Drive" `
-scriptPath $user."Script Path" `
-SamAccountName $user."SAM Account Name" `
-path $user."OU Name"
View Get Storage Total.ps1
#Create a CSV file with a Column called name containing all your VM names, 1 per line.
$vmlist = import-csv "c:\your\csv\here.csv"
$totaldiskgb = @()
foreach ($vm in $vmlist) {
$disksum = get-vm $ | get-harddisk | Select-Object CapacityGB | Measure-Object CapacityGB -Sum
$totaldiskgb += $disksum.sum
$gb = ($totaldiskgb | measure-object -sum).sum
Write-host " Total Size $t GB"
View ps_robocopy.ps1
#Requires -Version 4
## Robocopy Script for multiple data sources
## Created for Grupe File Server Migration
# Run this script on the target server (where file shares are getting migrated to)
$LogFile = "$PSScriptRoot\logs\Migrate-FileShares_$SourceServer-$(Get-Date -format yyyy-MM-dd_hh-mm-sstt).txt"
$RoboLog = "$PSScriptRoot\logs\Robo-Migrate-FileShares_$SourceServer-$(Get-Date -format yyyy-MM-dd_hh-mm-sstt).txt"
nshores / sage_install.ps1
Last active May 17, 2018
View sage_install.ps1
#Note - For no UAC POP Requires UAC to be disabled. Also, Requires executionpoliy set to bypass, or unrestricted.
$arg = 'RESPONSEFILE="\\WCI-APP\Timberline Office\Install Scripts\ClientResponse.log"',
#Check for .net 3.5
$fxstate = Get-WindowsCapability -Online -Name NetFX3~~~~
if ($fxstate.state -ne "Installed"){write-host "Installing .Net Framework 3.5"}
View move_vm.ps1
connect-viserver rmivc.rci.local
$vmlist = "rmiacct","rmifiles1"
foreach ($vm in $vmlist) {get-vm $vm | move-vm -Destination NS2}
You can’t perform that action at this time.