Skip to content

Instantly share code, notes, and snippets.

Avatar

9to5IT 9to5IT

View GitHub Profile
@9to5IT
9to5IT / Duplicate-PortGroups.ps1
Created Jan 24, 2015
PowerShell: Duplicate Port Groups from one vDS to another using PowerCLI
View Duplicate-PortGroups.ps1
#requires -version 3
<#
.SYNOPSIS
Copies port groups and all of their settings from one vDS to another vDS
.DESCRIPTION
This script is used to duplicate port groups (and their settings) from one vDS to another vDS.
This is useful if you want to create a duplicate vDS with the same configuration as the original
.PARAMETER
@9to5IT
9to5IT / PoweCLI_Script_Template_V2_Logs.ps1
Last active Jul 17, 2016
PowerShell: PowerCLI Script Template Version 2 (with logging)
View PoweCLI_Script_Template_V2_Logs.ps1
#requires -version 4
<#
.SYNOPSIS
<Overview of script>
.DESCRIPTION
<Brief description of script>
.PARAMETER <Parameter_Name>
<Brief description of parameter input required. Repeat this attribute if required>
@9to5IT
9to5IT / powercli_script_template.ps1
Last active Aug 17, 2017
PowerShell: PowerCLI Script Template
View powercli_script_template.ps1
#requires -version 2
<#
.SYNOPSIS
<Overview of script>
.DESCRIPTION
<Brief description of script>
.PARAMETER <Parameter_Name>
<Brief description of parameter input required. Repeat this attribute if required>
@9to5IT
9to5IT / Get-VCEvents.ps1
Last active Feb 3, 2018
PowerShell: Collect vCenter Events
View Get-VCEvents.ps1
#-----------------------------------------------------------------------------
# Import PowerCLI Module
#-----------------------------------------------------------------------------
Add-PSSnapin VMware.VimAutomation.Core
#-----------------------------------------------------------------------------
# Connect to vCenter Server
#-----------------------------------------------------------------------------
$Server = Read-Host 'Specify the vCenter Server or ESXi Host to connect to (IP or FQDN)?'
Connect-VMwareServer -VMServer $Server
@9to5IT
9to5IT / Get-RDM.ps1
Last active Aug 22, 2018
PowerShell: Searching for RDM disks using PowerCLI
View Get-RDM.ps1
#requires -version 4
<#
.SYNOPSIS
Seaches for an RDM with the specified LUN ID.
.DESCRIPTION
Searches the vCenter environment to find the Virtual Machine that has an RDM configured with a particular LUN ID.
.PARAMETER None
@9to5IT
9to5IT / Get-UniqueVCEvents.ps1
Last active Aug 22, 2018
PowerShell: Get list of unique vCenter Events
View Get-UniqueVCEvents.ps1
#-----------------------------------------------------------------------------
# Import PowerCLI Module
#-----------------------------------------------------------------------------
Add-PSSnapin VMware.VimAutomation.Core
#-----------------------------------------------------------------------------
# Connect to vCenter Server
#-----------------------------------------------------------------------------
$Server = Read-Host 'Specify the vCenter Server or ESXi Host to connect to (IP or FQDN)?'
Connect-VMwareServer -VMServer $Server
@9to5IT
9to5IT / Get-AccountLockouts.ps1
Last active Aug 22, 2018
PowerShell: Get-WinEvent to find Account Lockout Events
View Get-AccountLockouts.ps1
#requires -version 2
<#
.SYNOPSIS
Lists date, time and machine name where the specified account was locked. Used for troubleshooting account lockout issues.
.DESCRIPTION
This script outputs to specified file all of the recent account lockouts that have occurred for the specified user. The results returned are the machine name where this has occurred and the data & time it occurred at. This script is very useful for troubleshooting account lockout issues.
Note: This script only searches current security logs on the domain controllers specified within the $DCs variable
@9to5IT
9to5IT / Get-PrintedDocs.ps1
Last active Aug 22, 2018
PowerShell: Get list of printed documents
View Get-PrintedDocs.ps1
$aPrinterList = @()
$StartTime = "11/01/2013 12:00:01 PM"
$EndTime = "11/01/2013 6:00:01 PM"
$Results = Get-WinEvent -FilterHashTable @{LogName="Microsoft-Windows-PrintService/Operational"; ID=307; StartTime=$StartTime; EndTime=$EndTime;} -ComputerName "print-01"
ForEach($Result in $Results){
$ProperyData = [xml]$Result.ToXml()
$PrinterName = $ProperyData.Event.UserData.DocumentPrinted.Param5
@9to5IT
9to5IT / PowerCLI_Script_Template_V2_NoLogs.ps1
Last active Jun 11, 2019
PowerShell: PowerCLI Script Template Version 2 (without logging)
View PowerCLI_Script_Template_V2_NoLogs.ps1
#requires -version 4
<#
.SYNOPSIS
<Overview of script>
.DESCRIPTION
<Brief description of script>
.PARAMETER <Parameter_Name>
<Brief description of parameter input required. Repeat this attribute if required>
@9to5IT
9to5IT / Encryption_Functions.ps1
Created Mar 18, 2014
PowerShell: Encryption Functions
View Encryption_Functions.ps1
Function Set-EncryptKey{
<#
.SYNOPSIS
Used to create an encryption \ decryption key
.DESCRIPTION
This function is used to create an encrytpion \ decryption key that will be used in conjunction with PowerShell cmdlets and functions to encrypt and decrypt data.
The key needs to be between 16 and 32 characters in length.
.PARAMETER Key
You can’t perform that action at this time.