Skip to content

Instantly share code, notes, and snippets.

View vScripter's full-sized avatar
👨‍💻

Kevin Kirkpatrick vScripter

👨‍💻
View GitHub Profile
@vScripter
vScripter / HTML_Server_Disk_Space_Report.ps1
Last active December 22, 2015 21:19
HTML PowerShell Server Disk Space Report
<#
HTML Server Disk Usage Report Script
Kevin Kirkpatrick
www.vmotioned.com
Created 7/31/2013
This report, as currently written, is meant to create and save the HTML report in a location of your Choosing.
If attaching the HTML report is desired, edit the EMail settings attachemtn location variable and go to the
bottom of the script and un-comment the attachment options.
#>
@vScripter
vScripter / Invoke-LocalAdminAudit.ps1
Created April 9, 2014 21:29
Get Members of the local Administrators group on Selected Computers/Servers
[cmdletbinding()]
param (
[parameter(mandatory = $true)]
[string[]]$Servers
)
$results = @()
@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 / Get-NetStat.ps1
Last active September 22, 2016 08:20
Get-NetStat PowerShell Function
function Get-NetStat
{
<#
.SYNOPSIS
This function will get the output of netstat -n and parse the output
.DESCRIPTION
This function will get the output of netstat -n and parse the output.
Credit goes to PowerShell MVP Francois-Xavier Cat, who wrote the orignial function to parse the output of netstat.exe -n.
@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 / 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 / Delete-RemoteProfile.ps1
Last active October 5, 2016 10:02
Remove Windows profile from computer using WMI
(Get-WMIObject -ComputerName $computer -Class win32_UserProfile -Filter "SID = $SID").delete()