Skip to content

Instantly share code, notes, and snippets.

Kevin Kirkpatrick vScripter

View GitHub Profile
@vScripter
vScripter / Get-PendingReboot.ps1
Created Aug 13, 2018
Gets the pending reboot status on a local or remote computer.
View Get-PendingReboot.ps1
<#
.SYNOPSIS
Gets the pending reboot status on a local or remote computer.
.DESCRIPTION
This function will query the registry on a local or remote computer and determine if the
system is pending a reboot, from either Microsoft Patching or a Software Installation.
For Windows 2008+ the function will query the CBS registry key as another factor in determining
pending reboot state. "PendingFileRenameOperations" and "Auto Update\RebootRequired" are observed
as being consistant across Windows Server 2003 & 2008.
@vScripter
vScripter / VMHost-Mapping.ps1
Last active Jul 26, 2018
PowerCLI example using Get-View filtering to create a VMHost inventory mapping
View VMHost-Mapping.ps1
# Gather a list of Datacenters, but only pull the name
$datacenterQuery = Get-View -Server $viServer -ViewType Datacenter -Property Name -ErrorAction 'Stop'
foreach ($datacenter in $datacenterQuery) {
# Grab a list of clusters, but only pull the name - also use the current datacenter as the search root
$clusterQuery = Get-View -Server $viServer -ViewType ClusterComputeResource -Property Name -SearchRoot $datacenter.MoRef
foreach ($cluster in $clusterQuery) {
View Docker-alpine-test.sh
docker build -t vscripter/alpine-ssh:v1 .
docker push vscripter/alpine-ssh:v1
# ran a few commands and then jumped out and left the container running
docker run -it --name alpine-v2 vscripter/alpine-ssh:v1
# added elinks just to test
docker exec -it alpine-v2 apk add elinks
docker commit alpine-v2 vscripter/alpine-ssh:v2
@vScripter
vScripter / Get-WinProductKey.ps1
Last active Dec 21, 2017
Return windows product key
View Get-WinProductKey.ps1
function Get-WinProductKey {
$map="BCDFGHJKMPQRTVWXY2346789"
$value = (get-itemproperty "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion").digitalproductid[0x34..0x42]
$ProductKey = ""
for ($i = 24; $i -ge 0; $i--) {
$r = 0
for ($j = 14; $j -ge 0; $j--) {
$r = ($r * 256) -bxor $value[$j]
$value[$j] = [math]::Floor([double]($r/24))
$r = $r % 24
@vScripter
vScripter / Get-VILicense.ps1
Created Sep 21, 2017
Return vSphere licenses from a vCenter Server
View Get-VILicense.ps1
function Get-VILicense {
<#
.SYNOPSIS
Return vSphere license deatils from the connected vCenter Server(s)
.DESCRIPTION
Return vSphere license deatils from the connected vCenter Server(s)
.EXAMPLE
Get-VILicense -Verbose
.OUTPUTS
View Disabling IPv6 In Ubuntu Server 10.04 LTS.sh
# check to see if IPv6 config status
cat /proc/sys/net/ipv6/conf/all/disable_ipv6
# edit sysctl.conf
vi /etc/sysctl.conf
#disable ipv6 
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1
View Worklog-Module-9.md

Work Log

Friday, February 06, 2015

  • This is the first item of the day
    • This is the first sub-item of the day
      • This is the first sub-sub-item of the day
  • This is the second item of the day
  • This is what using back-tick marks through the PowerShell console can be used to show code in the GFM
View Worklog-Module-8.txt
## Work Log
### Friday, February 06, 2015
* This is the first item of the day
* This is the first sub-item of the day
* This is the first sub-sub-item of the day
* This is the second item of the day
* This is what using back-tick marks through the PowerShell console can be used to ``show code`` in the GFM
View Worklog-Module-7.ps1
Add-WorkLog 'This is the first item of the day'
Add-WorkLog 'This is the first sub-item of the day' -Indent 1
Add-WorkLog 'This is the first sub-sub-item of the day' -Indent 2
Add-WorkLog 'This is the second item of the day'
Add-WorkLog "This is how using back-tick marks through the PowerShell console can be used to ````show code```` in the GFM"
View Worklog-Module-7.ps1
PROCESS {
if (Test-Path -LiteralPath $filePath -PathType Leaf) {
Get-Content -LiteralPath $filePath -ReadCount 0
} else {
Write-Warning -Message 'Work Log file has not been created'
You can’t perform that action at this time.