Skip to content

Instantly share code, notes, and snippets.

View vScripter's full-sized avatar
👨‍💻

Kevin Kirkpatrick vScripter

👨‍💻
View GitHub Profile
<#
.SYNOPSIS
Retrieves all logged on users from a local or remote system
.DESCRIPTION
RRetrieves all logged on users from a local or remote system.
This script/function parses the output from the 'qwinsta' command, and formats it into a proper PSObject
.INPUTS
System.String
<#
.SYNOPSIS
This function will log off the specified user/session, based on session ID
.DESCRIPTION
This function will log off the specified user/session, based on session ID.
It was written to accept pipeline input from the Get-LoggedOnUser function, but it can also be run as a stand-alone function, if desired.
.PARAMETER ComputerName
Name of computer/s
function Start-LogLyncAvailability {
[CmdletBinding(
SupportsShouldProcess = $false,
ConfirmImpact = "None",
DefaultParameterSetName = "")]
param (
[Parameter(
Position = 0,
ValueFromPipeLine = $false,
Mandatory = $true,
# No need for the code on the next line, just put the functions in this script; you run into scoping issues dot sourcing these functions, the way they are written
#. .\func1.ps1
#region functions
function Start-LogLyncAvailability {
[CmdletBinding(
SupportsShouldProcess = $false,
ConfirmImpact = "None",
DefaultParameterSetName = "")]
@vScripter
vScripter / New-Object.ps1
Created April 13, 2015 03:44
Creating new object
$queryItems = Get-Service | Select ServiceName,Status
foreach ($service in $queryItems) {
# clear on each iteration
$objSvc = @()
# create properties and assign values; in this example I am using strong types to define the type of value
# the property will return
$objSvc = [PSCustomObject] @{
Service = [System.String]$service.ServiceName
@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 / Get-VMDetails.ps1
Created April 7, 2016 16:18
Get-VMDetails.ps1
function Get-VMDetails {
<#
.SYNOPSIS
Returns more detailed statistics and configuration for a single or multiple VMs
.DESCRIPTION
Returns more detailed statistics and configuration for a single or multiple VMs
.PARAMETER Server
VI (vCenter) server name
@vScripter
vScripter / Get-VMGuestNetworkAdapter.ps1
Last active July 27, 2016 15:28
Returns VM Guest network adapter information, including detail about the virtual & IP interfaces
# this moved to the following repository: https://github.com/vScripter/vSphereNetworkInventory
@vScripter
vScripter / Get-VMHostVtepInterface.ps1
Last active August 10, 2016 18:59
Pull an inventory of all ESXi VTEP virtual interfaces from all connected vCenter Servers
function Get-VMHostVtepInterface {
<#
.SYNOPSIS
Gather VTEP interface inventory from all ESXi hosts
.DESCRIPTION
Gather VTEP interface inventory from all ESXi hosts.
This function was written with scale and speed in mind. It pull a host inventory using API calls and then unrolls API properties and
assigned them to a PSCustomObject.
@vScripter
vScripter / ESXi VTEP Report.ps1
Last active August 10, 2016 19:07
Basic script to pull an inventory of ESXi VTEP interfaces
$vtepReportPath = "$Home\Desktop\ESXi_VTEP_Report.csv"
$vtepFinalReport = @()
Get-VMHostNetworkAdapter -VMKernel | Foreach-Object {
$vtepInterfaceQuery = $null
$vtepInterfaceQuery = $_.ExtensionData | Where-Object {$_.Spec.NetStackInstanceKey -eq 'vxlan'}
foreach ($vtep in $vtepInterfaceQuery) {