Skip to content

Instantly share code, notes, and snippets.

View vScripter's full-sized avatar
👨‍💻

Kevin Kirkpatrick vScripter

👨‍💻
View GitHub Profile
@vScripter
vScripter / Suspend-ScreenSaver.ps1
Created August 2, 2021 19:41
Suspend-ScreenSaver.ps1
<#
.NOTES
###########################################################
# NoSSaver.ps1
#
# Wayne Lindimore
# wlindimore@gmail.com
# AdminsCache.Wordpress.com
#
@vScripter
vScripter / PS Credential Encryption using Certs.ps1
Last active November 1, 2021 23:03
Example of how to use the ProtectedData PowerShell module to encrypt and decrypt credentials using a certificate
<#
These are examples of the process flow of using the ProtectedData PowerShell Module to encrypt a credential using certificates
on two servers
https://github.com/dlwyatt/ProtectedData
This does not represent a recommended approach, per se, but it does offer another secure means of persisting credentials to
a file vs. using DPAPI (Data Protection API); it's mainly written to help people grasp some basic concepts of asymmetric
encryption, in action.
@vScripter
vScripter / Get-PendingReboot.ps1
Created August 13, 2018 19:56
Gets the pending reboot status on a local or remote computer.
<#
.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.
function Get-RDM {
[OutputType([System.Management.Automation.PSCustomObject])]
[cmdletbinding(DefaultParameterSetName = 'default')]
param (
[parameter(
Mandatory = $true,
ValueFromPipeline = $true,
Position = 0,
ParameterSetName = 'default')]
@vScripter
vScripter / VMHost-Mapping.ps1
Last active July 26, 2018 14:40
PowerCLI example using Get-View filtering to create a VMHost inventory mapping
# 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) {
@vScripter
vScripter / Docker-alpine-test.sh
Last active February 28, 2018 04:12
Docker Commit Test
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 December 21, 2017 23:45
Return windows product key
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 September 21, 2017 19:06
Return vSphere licenses from a vCenter Server
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
# 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

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