Skip to content

Instantly share code, notes, and snippets.

View michaeltlombardi's full-sized avatar

Mikey Lombardi (He/Him) michaeltlombardi

View GitHub Profile
@michaeltlombardi
michaeltlombardi / Update-VMWareTools.ps1
Last active October 3, 2015 15:22
Update VMWare Tools from Unpacked ISO in Repository
Function Update-VMWareTools {
<#
.Synopsis
Update VMWare Tools from an unpacked ISO file on a shared repository.
.Description
Update VMWare Tools from an unpacked ISO file on a shared repository. As of
VMWare Tools Version 10, the VMWare releases the tools separately from the
ESXi patches and does so as individual ISO files. In order to use this function,
copy the ISO to a shared repository in your environment, and extract it into a
@michaeltlombardi
michaeltlombardi / New-Identity.ps1
Last active October 6, 2015 00:57
Example of a New-<Whatever> Powershell function with default views.
Function New-Identity {
<#
.Synopsis
Creates a new identity.
.Description
Creates a new identity with UID, Email, and UPN.
.Parameter UID
@michaeltlombardi
michaeltlombardi / Set-DefaultPropertyDisplaySet.ps1
Last active November 22, 2022 12:34
Function for Adding a Default Property Display Set to PSCustomObjects.
Function Set-DefaultPropertyDisplaySet {
<#
.Synopsis
Adds a Default Property Display Set to a PSCustomObject.
.Description
Adds a Default Property Display Set to a PSCustomObject. The default display will be formatted as a table; the columns will be in the
same order as they are passed to the function.
Function New-NanoElasticsearchVM {
param (
[PSCredential]$Credential = (Get-Credential -UserName Administrator -Message "Enter your password; DO NOT CHANGE THE USERNAME!"),
[string]$ComputerName = "nes01",
[string]$ISOPath = "$env:HOMEDRIVE$Env:HomePath\downloads\10514.0.150808-1529.TH2_RELEASE_SERVER_OEMRET_X64FRE_EN-US.ISO",
[string]$MediaPath = "C:\W2016Media",
[string]$NanoPath = "C:\nano",
[int64]$MemoryStartupBytes = (2*1024*1024*1024),
[string]$VMSwitchName = "vExternal"
)
@michaeltlombardi
michaeltlombardi / Get-AppLockerEvent.ps1
Created December 2, 2015 14:51
Get-AppLockerEvent
Function Get-AppLockerEvent {
<#
.Synopsis
Retrieve AppLocker events from one or more computers.
.Description
Retrieve AppLocker events from one or more computers. AppLocker events can be queried by either EventType (a plain-english explanation of the general type of event) or EventID.
.Parameter ComputerName
The name of the computer whose eventlogs will be queried for AppLocker events. If no ComputerName is specified, the function will default to the localhost.
@michaeltlombardi
michaeltlombardi / PSAPI-Matrix-ByVendorAndSoftware.md
Last active December 8, 2015 20:23
Vendor and Software API/Powershell Support Matrix

Vendor and Software API/Powershell Support Matrix

Note: I've made a more robust project for this here.

##Synopsis This document is intended to represent the level of excellence a given vendor's specific software has achieved with regard to both API and Powershell modules. If specific reviews of the API and/or module are available, link to them or add in subsections below.

##Matrix Instructions

  1. Ensure that the order is alphabetical by vendor first and software second.
  2. Rate the availability and quality of the API, Powershell Module, and DSC Resources on a scale from 0 to 10, where 0 is nonexistant and 10 is best-in-class.
$TargetComputers = Import-Csv c:\ADcomputers.csv | Select-Object -ExpandProperty Name
ForEach($Target in $TargetComputers){
If (Test-Connection -ComputerName $Target -Count 1){
Get-Hotfix -ComputerName $Target |
Sort-Object -Property InstalledOn -Descending |
Select-Object -First 1 -Property InstalledOn,PSComputerName |
Export-Csv -Path C:\patchstatus.csv -Append
} Else {
Write-Error "Unable to connect to $Target"
}
@michaeltlombardi
michaeltlombardi / Get-VSCodeSnippet.ps1
Created February 22, 2016 19:53
Get Visual Studio Code Snippets via PowerShell
function Get-VSCodeSnippet {
<#
.SYNOPSIS
Return the list of Snippets from a VSCode JSON file.
.DESCRIPTION
Given the path to one or more Visual Studio Code JSON files, the function returns all of the associated snippets, their prefix, description, and body, as well as their source file. Useful for discovering snippets after updating an extension or when using it for the first time.
.PARAMETER Path
The full path to one or more Visual Studio Code Snippet JSON files. By default this command will return all of the snippets found in the current user's loaded extensions and in the extensions which shipped directly with Visual Studio Code.
.EXAMPLE
C:\PS> Get-VSCodeSnippet -Path C:\Users\John.Doe\.vscode\extensions\ms-vscode.PowerShell-0.4.1\snippets\PowerShell.json
@michaeltlombardi
michaeltlombardi / potential-stlpsug-directory-structure.txt
Last active March 18, 2016 18:26
A proposed directory structure for the STLPSUG main repository.
.
| -- communication.md
| -- contributions.md
| -- current-events.md
| -- documents
| | -- sponsorship.md
| | -- steering.md
| | -- ?
| -- events
| | -- meetups
@michaeltlombardi
michaeltlombardi / uploadblobsite.sh
Created April 26, 2016 20:41
Upload the required info for a mkdocs site to an Azure Storage Blob
#!/bin/sh
export AZURE_STORAGE_ACCOUNT='Your_Account_here'
export AZURE_STORAGE_ACCESS_KEY='Your_Key_Here'
export container_name='Your_Container_Here'
export source_folder=~/local/path/to/your/site/folder/*
export version='vX.Y.Z' # Replace this with the appropriate version for your docs.
export doclang='en-US' # Replace this if the language isn't American English.
root_folder=${source_folder:0:(-1)}