Skip to content

Instantly share code, notes, and snippets.

@sudo-battlekafer
sudo-battlekafer / Update_HWversion.ps1
Created September 2, 2022 14:15
Powercli Upgrade Hardware version to 19
#import PoSH modules
Write-Verbose -Message "Loading Modules..." -Verbose
Get-Module -ListAvailable VMware* | Import-Module | Out-Null
#connect to VCenter
$path = "C:\Users\$env:UserName\.ssh\vmca.xml"
if(!(test-Path $path)){
Write-Host "Please create VMWare credentials file with the command"
Write-Host "New-VICredentialStoreItem -Host <vCenter server name/IP> -User <User name of vCenter server administrator> -Password <Password> -File <Location where you want to save the file to along with file name>"
Write-Host "Example: New-VICredentialStoreItem -Host vcenter.example.com -User joe.smith@example.com -Password 12345678910$# -File C:\Users\$env:UserName\.ssh\vmca.xml"
@sudo-battlekafer
sudo-battlekafer / Get-VMReport.ps1
Created September 2, 2022 14:14
Powercli VM Report
#import PoSH modules
Write-Verbose -Message "Loading Modules..." -Verbose
Get-Module -ListAvailable VMware* | Import-Module | Out-Null
#connect to VCenter
$path = "C:\Users\$env:UserName\.ssh\vmca.xml"
if(!(test-Path $path)){
Write-Host "Please create VMWare credentials file with the command"
Write-Host "New-VICredentialStoreItem -Host <vCenter server name/IP> -User <User name of vCenter server administrator> -Password <Password> -File <Location where you want to save the file to along with file name>"
Write-Host "Example: New-VICredentialStoreItem -Host vcenter.example.com -User joe.smith@example.com -Password 12345678910$# -File C:\Users\$env:UserName\.ssh\vmca.xml"
@sudo-battlekafer
sudo-battlekafer / new-snap.ps1
Created March 3, 2022 22:22
VMWare Snapshot creation script
param(
[parameter(mandatory = $true)][String]$VMName
)
# Requires that you have PowerCli installed
# Get it with the command: PS> Install-Module -Name VMware.PowerCLI
Clear-Host
Write-Verbose -Message "Loading Modules..." -Verbose
if (Get-Module -ListAvailable -Name VMware.PowerCLI) {
Write-Host "Module exists"
@sudo-battlekafer
sudo-battlekafer / Install_Updates_and_REBOOT.ps1
Created October 24, 2021 02:22
Powershell script to Update Windows and Reboot
Function Get-WUInstall
{
<#
.SYNOPSIS
Download and install updates.
.DESCRIPTION
Use Get-WUInstall to get list of available updates, next download and install it.
There are two types of filtering update: Pre search criteria, Post search criteria.
- Pre search works on server side, like example: ( IsInstalled = 0 and IsHidden = 0 and CategoryIds contains '0fa1201d-4330-4fa8-8ae9-b877473b6441' )
@sudo-battlekafer
sudo-battlekafer / .env
Last active December 11, 2021 16:26
docker-compose for various
# Your timezone, https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
TZ=America/Chicago
# UNIX PUID and PGID, find with: id $USER
PUID=1001
PGID=1001
# The directory where data and configuration will be stored Example /docker or /data.
ROOT=/data
# CONTAINER STUFF
@sudo-battlekafer
sudo-battlekafer / docker-compose-mc.yml
Last active December 15, 2021 04:22
basic docker-compose for Minecraft servers
version: "3.4"
services:
# for PC minecraft
minecraft-java:
image: itzg/minecraft-server
ports:
- 25565:25565
volumes:
- ${ROOT}/config/minecraft-java:/data
environment:
@sudo-battlekafer
sudo-battlekafer / backup_plex.sh
Last active October 16, 2021 01:45
Plex Database backup shell script with hardcoded values (better for cron jobs)
#!/bin/bash
# Backup a Plex database.
# Plex Database Location. The trailing slash is
# needed and important for rsync.
# Change to your value
plexDatabase="/data/config/plex/config/Library/Application Support/Plex Media Server/"
@sudo-battlekafer
sudo-battlekafer / plex_backup.sh
Last active October 16, 2021 01:45
Plex backup script with variables for paths
#!/bin/bash
# Backup a Plex database.
# Plex Database Location. The trailing slash is
# needed and important for rsync.
read -p "Enter cull path of Plex Directory" plexDatabase
name=${plexDatabase:-"/data/config/plex/config/Library/Application Support/Plex Media Server/"}
@sudo-battlekafer
sudo-battlekafer / docker-setup.sh
Last active June 30, 2022 21:36
Docker install/configure for Ubuntu with NFS or SMB storage
#!/bin/bash
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit
fi
#prep for media mount
apt-get update
apt-get install -y nfs-common cifs-utils