This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-ESXiSerials { | |
<# | |
.SYNOPSIS | |
Get the serial number and service tags for ESXi hosts | |
#> | |
Param( | |
# Full name of host or a regex | |
[Parameter(Mandatory = $false)] | |
[string]$HostSpec | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Write-ScriptEvent { | |
<# | |
.SYNOPSIS | |
Wrapper to write PowerShell transcripts to the event log. | |
#> | |
Param( | |
# Transcript file to read from | |
[Parameter(Mandatory = $true)] | |
[string]$LogFile, | |
# Event source to apply |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Automated PowerCLI connections to vCenter Server | |
# Script will use stored PSCredentials if user is unprivileged | |
function AutoConnect-VIServer () { | |
Param( | |
[string]$server = 'vcenter' | |
) | |
# Check if user is in a group with vCenter permissions | |
if ([System.Security.Principal.WindowsIdentity]::GetCurrent().Groups.Translate( | |
[System.Security.Principal.NTAccount]) -contains 'DOMAIN\vCenter_Admins') { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Get completion percentage for batch VM clone tasks | |
function Get-VMDeployProgress() { | |
[Alias('deployProgress')] | |
Param( | |
[string]$VCUser = $global:DefaultVIServers[0].User.Split('\')[1] | |
) | |
do { | |
$Tasks = Get-Task | Where-Object { $_.Name -match 'clone' ` | |
-and $_.State -match 'running' ` | |
-and $_.ExtensionData.Info.Reason.UserName -match $VCUser } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Set-ScriptSignature { | |
<# .SYNOPSIS | |
Wrapper function to sign and timestamp a script file #> | |
[Alias('SignScript')] | |
Param( | |
# The script file to sign | |
[Parameter(Mandatory)] | |
[String]$ScriptFile | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-SSLServerCertificate { | |
<# .SYNOPSIS | |
Retrieves the X509 certificate by connecting to a SSL enabled server #> | |
[Alias('s_client')] | |
Param( | |
# Hostname or IP address to connect to | |
[Parameter(Mandatory)] | |
[String]$Hostname, | |
# Port to connect to | |
[Parameter()] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-SMSManagementPoint { | |
<# .SYNOPSIS | |
Finds SCCM management point based on site code #> | |
Param( | |
# The site code to search | |
[Parameter(Mandatory)] | |
[string]$SiteCode | |
) | |
return [adsisearcher]::new( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Resolve-DnsRecordAllDCs { | |
<# .SYNOPSIS | |
Resolves a DNS record on all active DCs in a domain #> | |
[Alias('nslookup_all')] | |
Param( | |
# Name to resolve | |
[Parameter(Mandatory, ValueFromPipeline)] | |
[string]$Name, | |
# Type of record | |
[Parameter(ValueFromPipelineByPropertyName)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Set-StrictMode -Version Latest | |
function Edit-VMDKHeader { | |
<# .SYNOPSIS | |
Edit the metadata header of a VMDK file #> | |
[CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'High')] | |
Param( | |
# The VMDK file to edit | |
[Parameter(Mandatory)] | |
[string]$VMDKFile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Set-StrictMode -Vesion Latest | |
function Invoke-GithubFileRequest { | |
<# .SYNOPSIS | |
Retrieves a file from a Github repository. #> | |
[Alias('gh_curl')] | |
Param( | |
# URL of file to download | |
[Parameter(Mandatory)] | |
[Uri]$URL, |