Skip to content

Instantly share code, notes, and snippets.

View jeffgreenca's full-sized avatar

jeffg jeffgreenca

  • Greater Seattle Area, WA
View GitHub Profile
'Usage: psexec @target-computer-list.txt -u "username" cscript \\share\get-update-history.vbs
'Unfortunately, nicer methods like PowerShell Get-Hotfix / WMI query to Win32_QuickFixEngineering does not capture a complete list of updates
'If you have servers with various versions of .NET, PowerShell, without PowerShell, and they aren't all under SCCM or some other kind of centralized management, this might be your best shot at reporting updates.
'This method will get everything, but then needs to be parsed for Operation (not necessarily an Install), and result (not necessarily successful)
'Extracting a KB number is basically just a regex for the content between ( and )
'For more, see https://msdn.microsoft.com/en-us/library/windows/desktop/aa387291(v=vs.85).aspx and https://msdn.microsoft.com/en-us/library/windows/desktop/aa386077(v=vs.85).aspx
Dim o
Set o = CreateObject("Microsoft.Update.Session")
Set s = o.CreateUpdateSearcher()
@jeffgreenca
jeffgreenca / anaconda-tensorflow-keras.txt
Created March 29, 2017 00:45
Anaconda Keras / TensorFlow environment setup
Install TensorFlow (CPU), Keras, and some other tools to a new anaconda environment.
Open Anaconda Prompt
conda create --name tensorflow35 python=3.5
conda activate tensorflow35
conda install jupyter
conda install scipy
conda install spyder
pip install tensorflow
@jeffgreenca
jeffgreenca / iovDisableIR-disable.ps1
Created January 23, 2017 19:30
Jason Coleman's script to turn off iovDisableIR per http://www.oshelp.co.uk/?p=96
$allHosts = get-folder unconfigured | get-vmhost | sort name
foreach ($thisHost in $allHosts){
$esxcli = get-esxcli -VMHost $thisHost -v2
if (($esxcli.system.settings.kernel.list.invoke() | ? {$_.name -like 'iovDisableIR'}).Configured -eq "TRUE"){
write-host "Working on $($thisHost.name)..."
$arguments = $esxcli.system.settings.kernel.set.CreateArgs()
$arguments.setting = "iovDisableIR"
$arguments.value = "FALSE"
$esxcli.system.settings.kernel.set.Invoke($arguments)
}
#Reduces the Disk.MaxLun on all connected ESXi hosts, as a workaround to an incorrect PDL error with ESXi 6.0+ and HPE 3PAR.
#Works by reducing the Disk.MaxLun below the 3PAR PE LUN 256, thus the PE LUN is not scanned and will not throw an unexpected PDL.
Get-VMHost | % { Get-AdvancedSetting -Entity $_ -Name "Disk.MaxLUN" | Set-AdvancedSetting -Value 255 }
@jeffgreenca
jeffgreenca / fitbithr.js
Last active January 5, 2022 12:14
Quick & Dirty nodejs app to get Fitbit second by second heart rate data
//For info about this gist, see my blog entry https://virtualdatacave.com/2016/09/fitbit-hr-data-raw/
//For API see https://dev.fitbit.com/docs/heart-rate/#get-heart-rate-intraday-time-series
var dateFormat = require('dateformat');
// initialize the express application
var express = require("express"),
app = express();
var transform = null;
if (thinProvisioned == true) {
transform = VcVirtualMachineRelocateTransformation.sparse;
} else if (thinProvisioned == false) {
transform = VcVirtualMachineRelocateTransformation.flat;
}
if (datastore == null) {
datastore = vm.datastore[0];
}
@jeffgreenca
jeffgreenca / fractal-plant.html
Created June 15, 2016 23:11
Having fun with HTML5 and L-system to draw a fractal tree.
<html>
<head>
</head>
<body>
<canvas id="drawing" width="800" height="800" style="border: 1px solid black;"> </canvas>
<p>Implements Wikipedia <a href="https://en.wikipedia.org/wiki/L-system">L-system entry</a> Example 7 Fractal Plan using client side JavaScript and HTML5.<p>
<p>See source for details</p>
<script>
//Key variables
#Set SSH service to manual and stop it
Get-VMHost | Get-VMHostService | ? key -eq "TSM-SSH" | Set-VMHostService -Policy Off | Stop-VMHostService
@jeffgreenca
jeffgreenca / cleanup-winimage.bat
Created May 26, 2016 17:34
dism cleanup windows template image
DISM.exe /online /Cleanup-Image /StartComponentCleanup /ResetBase
#Check for Windows VMs with LSI driver version affected by VMware KB 2063346
(Get-VM | ? powerstate -eq "PoweredOn" | ? {$_.guest.osfullname -match "Windows"}).Guest | Export-Csv temp.csv
Import-Csv temp.csv | % { Get-WmiObject Win32_PnPSignedDriver -ComputerName $_.Hostname | select __SERVER, devicename, driverversion | where {$_.devicename -like "*LSI*" } }