Skip to content

Instantly share code, notes, and snippets.

👨‍💻

Kevin Kirkpatrick vScripter

👨‍💻
View GitHub Profile
@vScripter
vScripter / Get-ProcessorInventory.ps1
Created Apr 16, 2014
Returns information about the Processor via WMI
View Get-ProcessorInventory.ps1
<#
.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
Saturate selected or all CPU cores for utilization stress testing, etc.
View Invoke-CPUStressTest.ps1
[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 Dec 20, 2014
PS Custom Object Example
View xGet-DiskSpace.ps1
[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 Aug 29, 2015
PowerCLI PSSnapins
View Add-PowerCLI.ps1
<#
.DESCRIPTION
Load appropriate PowerCLI PSSnapins. These are based on PowerCLI 5.8 R1.
#>
[cmdletbinding()]
param()
PROCESS {
try {
@vScripter
vScripter / Get-VMToolsB2VMapping.ps1
Created Jan 28, 2015
Get VMware Tools Build-to-Version correlations, directly from VMware using Invoke-RestMethod
View Get-VMToolsB2VMapping.ps1
<#
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 Aug 29, 2015
Set-ConsoleWindowTitle - Set the PowerShell console window title to a custom message or a custom 'default' message.
View Set-ConsoleWindowTitle.ps1
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 Aug 29, 2015
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
View Get-OrderedVM.ps1
function Get-OrderedVM {
[cmdletbinding()]
param (
[parameter(Mandatory = $true, Position = 0)]
[alias('VM')]
[String[]]$Name
)
$finalResult = @()
View Test-Function.ps1
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 Mar 31, 2015
Script to remove a selected AD user profile from a system or multiple systems
View Remove-UserProfile.ps1
[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,
You can’t perform that action at this time.