Skip to content

Instantly share code, notes, and snippets.

View vScripter's full-sized avatar
👨‍💻

Kevin Kirkpatrick vScripter

👨‍💻
View GitHub Profile
@vScripter
vScripter / Get-ProcessorInventory.ps1
Created April 16, 2014 16:16
Returns information about the Processor via WMI
<#
.SYNOPSIS
Returns information about the Processor via WMI.
.DESCRIPTION
Information about the processor is returned using the Win32_Processor WMI class.
You can provide a single computer/server name or supply an array/list.
.PARAMETER Computers
@vScripter
vScripter / Invoke-CPUStressTest.ps1
Created May 6, 2014 02:02
Saturate selected or all CPU cores for utilization stress testing, etc.
[cmdletbinding()]
param(
[parameter(mandatory=$true)]
[int]$NumHyperCores
)
$Log = "C:\CPUStressTest.ps1.log"
$StartDate = Get-Date
Write-Output "============= CPU Stress Test Started: $StartDate =============" >> $Log
Write-Output "Started By: $env:username" >> $Log
@vScripter
vScripter / xGet-DiskSpace.ps1
Created December 20, 2014 04:27
PS Custom Object Example
[cmdletbinding(PositionalBinding = $true,
DefaultParameterSetName = "Default")]
param (
[parameter(mandatory = $false,
ValueFromPipeline = $true,
ValueFromPipelineByPropertyName = $true,
Position = 0)]
[alias('Comp', 'Name', 'DNSHostName')]
[string[]]$ComputerName = 'localhost'
)
@vScripter
vScripter / Add-PowerCLI.ps1
Last active August 29, 2015 14:11
PowerCLI PSSnapins
<#
.DESCRIPTION
Load appropriate PowerCLI PSSnapins. These are based on PowerCLI 5.8 R1.
#>
[cmdletbinding()]
param()
PROCESS {
try {
@vScripter
vScripter / Get-VMToolsB2VMapping.ps1
Created January 28, 2015 03:55
Get VMware Tools Build-to-Version correlations, directly from VMware using Invoke-RestMethod
<#
A more complete function can be found in my PowerCLI 'prod' repo at:
https://github.com/vMotioned/PowerCLI/blob/master/Get-VMToolsBuildToVersionMapping.ps1
#>
Invoke-RestMethod -Method Get -Uri 'http://packages.vmware.com/tools/versions'
@vScripter
vScripter / Set-ConsoleWindowTitle.ps1
Last active August 29, 2015 14:16
Set-ConsoleWindowTitle - Set the PowerShell console window title to a custom message or a custom 'default' message.
function Set-ConsoleWindowTitle {
[cmdletbinding()]
param (
[parameter(Mandatory = $true,
Position = 0,
ParameterSetName = 'Default')]
[validateset("Default", "Custom")]
[string]$MessageType,
@vScripter
vScripter / 0_reuse_code.js
Last active August 29, 2015 14:16
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
function Get-OrderedVM {
[cmdletbinding()]
param (
[parameter(Mandatory = $true, Position = 0)]
[alias('VM')]
[String[]]$Name
)
$finalResult = @()
function Test-Function {
[cmdletbinding(SupportsShouldProcess = $true, ConfirmImpact = 'High')]
param(
$ComputerName = $env:computername
)
PROCESS {
if($PSCmdlet.ShouldProcess($ComputerName,'Gathering Services')) {
@vScripter
vScripter / Remove-UserProfile.ps1
Created March 31, 2015 15:33
Script to remove a selected AD user profile from a system or multiple systems
[cmdletbinding(PositionalBinding = $true)]
param (
[parameter(Mandatory = $true,
Position = 0)]
[System.String[]]$ComputerName,
[parameter(Mandatory = $true,
Position = 1,
HelpMessage = "Enter the account name in 'DOMAIN\USERNAME' notation ")]
[System.String]$UserName,