Skip to content

Instantly share code, notes, and snippets.

View nshores's full-sized avatar
🏠
Working from home

Nick Shores nshores

🏠
Working from home
View GitHub Profile
@nshores
nshores / get-allsnapshot.ps1
Last active April 23, 2018 23:33
get-allvmsnapshot.ps1
<#
.Synopsis
Scans for all snapshots including hidden ones on all VM's, or selected ones.
.Description
Returns a list of snapshots that include hidden and visible ones. Invisble snapshots are considered snapshots that can only be found by searching the VMFS file system for *delta* files.
Pipeline support is included.
.Example
get-allvmsnapshot
Returns the total number of snapshot related files in the envionrment as well as a list of VM's with hidden snapshots.
> $ python3 cloudvisreq.py xxxxx mailpieceImg.jpg [±master ●]
Wrote 369757 bytes to jsons/mailpieceImg.jpg.json
---------------------------------------------
Bounding Polygon:
{'vertices': [{'x': 18, 'y': 19}, {'x': 652, 'y': 19}, {'x': 652, 'y': 426}, {'x': 18, 'y': 426}]}
Text:
Presorted Standard
U.S. POSTAGE PAID
AMERICAN EXPRESS
AMERICAN EXPRESS
@nshores
nshores / reboot_vm.ps1
Created May 11, 2018 17:28
reboot_vm.ps1
#Reboot VM's
$vmlist = "RMIP6S",
"rmipcs",
"rmipts",
"rmivcm",
"RCIACCT03",
"RMIXA02",
"RMIXA03",
"RMIXA05",
"RMIXA06",
connect-viserver rmivc.rci.local
$vmlist = "rmiacct","rmifiles1"
foreach ($vm in $vmlist) {get-vm $vm | move-vm -Destination NS2}
@nshores
nshores / sage_install.ps1
Last active May 17, 2018 16:46
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"',
'SUPPRESS_REBOOT_DIALOG=true',
'/silent',
'/debuglog"c:\temp\install_log.log"'
#Check for .net 3.5
$fxstate = Get-WindowsCapability -Online -Name NetFX3~~~~
if ($fxstate.state -ne "Installed"){write-host "Installing .Net Framework 3.5"}
#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 $vm.name | get-harddisk | Select-Object CapacityGB | Measure-Object CapacityGB -Sum
$totaldiskgb += $disksum.sum
}
$gb = ($totaldiskgb | measure-object -sum).sum
Write-host " Total Size $t GB"
@nshores
nshores / create_vm.ps1
Last active June 8, 2018 22:23
create_vm.ps1
#Make sure you are connected to vCenter
$vcenter = 'rgavc2'
$serverlist = $global:DefaultVIServer
if($serverlist -eq $null) {
write-host "Connecting to $vcenter"
connect-viserver -Server $vcenter
}
#User Configurtable Parmaters. Include each VM and it's associated IP in the list below.
$vmlist = @{"192.168.0.21" = "temp3"}
@nshores
nshores / new_ad_user.ps1
Created June 8, 2018 23:05
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"
@nshores
nshores / mysql_fix_db.sh
Created June 30, 2018 21:01
fix_mysql_db
#!/bin/bash
#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
done
@nshores
nshores / pypotato.py
Last active July 18, 2018 17:55
pypotato.py
#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)