Skip to content

Instantly share code, notes, and snippets.

View cybergavin's full-sized avatar

cybergavin cybergavin

View GitHub Profile
@cybergavin
cybergavin / callExecutable.ps1
Created November 12, 2020 23:51
Call executable within Powershell
# Call executable with values for input parameters
$socketTest = "C:\Program Files (x86)\check_mk\bin\socketTest.exe"
$Params = "tcp ${myNode}:${myPort} $timeout".Split(" ")
$myconn = & $socketTest $Params
@cybergavin
cybergavin / getWindowsCapability.ps1
Last active January 29, 2021 01:13
Check Windows Capabilities - Windows Server 2019
# Check all installed Windows Capabilities
Get-WindowsCapability -Online | where state -eq 'Installed'
# Check OpenSSH Windows Capabilities
Get-WindowsCapability -Online | where Name -match 'OpenSSH'
# Add-WIndowsCapability
PS C:\Users\Administrator> Add-WindowsCapability -Name OpenSSH.Server~~~~0.0.1.0 -Online
@cybergavin
cybergavin / fetchMyfiles.bat
Last active November 15, 2020 02:49
SCP files from remote machine - Windows Batch script
@echo OFF
:: ---------------------------------------------------------------------
:: Script : fetchMyfiles.bat
:: Description : SCP files from a remote machine.
:: Requires the OpenSSH client Windows Capability to be installed (Windows Server 2019)
:: ---------------------------------------------------------------------
::
:: Variables
::
set rootdir=D:\myfiles
@cybergavin
cybergavin / pstips01.ps1
Last active November 15, 2020 03:24
Powershell Tips for script information
# Hostname
$myhost=$env:COMPUTERNAME
# Script Name
$myname=[string] ($MyInvocation.MyCommand.Name)
# Script Path
$mypath=[string] ($MyInvocation.MyCommand.Definition)
# Script Directory
$scriptdir="$($mypath.substring(0,$mypath.LastIndexOf('\')))\.."
@cybergavin
cybergavin / scpFetch.ps1
Created November 16, 2020 04:01
SCP files from remote host
# ---------------------------------------------------------------------
# SCP files from remote host
# ---------------------------------------------------------------------
#
# Variables
#
$myHost=$env:COMPUTERNAME
$scriptPath=[string] ($MyInvocation.MyCommand.Definition)
$rootDir="$($scriptPath.substring(0,$scriptPath.LastIndexOf('\')))"
$scpKey="${rootDir}\id_rsa"
@cybergavin
cybergavin / ipv6-barrier.txt
Created December 8, 2020 01:23
Keyboard and mouse sharing via barrier over ipv6
# Barrier client on Manjaro Linux
cybergavin> ip -6 addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 state UNKNOWN qlen 1000
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
3: wlp4s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 state UP qlen 1000
inet6 fe80::4be8:842b:6d73:8992/64 scope link noprefixroute
valid_lft forever preferred_lft forever
cybergavin> telnet fe80::d478:413a:45f4:f96e%wlp4s0 24800
@cybergavin
cybergavin / ntnx-cvm-memreduce.txt
Last active December 15, 2020 05:13
Nutanix CVM Memory reduction
# Reduce a CVM's memory from 24GB to 20GB
###########################################################################
[root@ahv01 ~]# virsh list --all
Id Name State
----------------------------------------------------
2 NTNX-ahv01-CVM running
############################################################################
[root@ahv01 ~]# virsh dominfo NTNX-ahv01-CVM
Id: 2
@cybergavin
cybergavin / ADCS-SwitchHash.txt
Last active December 17, 2020 15:51
Switch Hashing Algorithm on AD CS CA
# Switch Hashing Algorithm on Issuing and Root CAs
certutil -setreg ca\csp\CNGHashAlgorithm SHA256
net stop certsvc
net start certsvc
# Renew Issuing CA
@cybergavin
cybergavin / NCC-checks.txt
Last active December 18, 2020 05:03
Nutanix Cluster Checks
Ensure PING is enabled from CVMs/AHVs to all services (DNS/AD/NTP) as NCC uses ping first!
ncc health_checks
+---------------------------------------------------------------------------------------------------------+
| Type | Name | Impact | Short help |
+---------------------------------------------------------------------------------------------------------+
| M | anomaly_checks | N/A | Anomaly checks |
| M | cassandra_checks | N/A | Cassandra related checks |
| M | cerebro_stats | N/A | Various cerebro stats collectors. |
| M | data_protection_checks | N/A | Data Protection related checks |
@cybergavin
cybergavin / GetScriptDir
Last active January 30, 2021 20:26
Get Current Script Directory
#
# Get the location of a script irrespective of how it's called (sourced or new shell) or
# where it's called from (absolute or relative paths).
#
##########################################################################################
# BASH
scriptDir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# PYTHON
from pathlib import *