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
#region >> Helper Functions | |
function Get-FilePath { | |
[CmdletBinding()] | |
Param ( | |
[Parameter(Mandatory=$True)] | |
[string]$FileNameWExtension, | |
[Parameter(Mandatory=$True)] | |
[string[]]$DirectoriesToSearch |
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
try { | |
$null = Enable-PSRemoting -Force -ErrorAction Stop | |
} | |
catch { | |
$null = Get-NetConnectionProfile | Where-Object {$_.NetworkCategory -eq 'Public'} | Set-NetConnectionProfile -NetworkCategory 'Private' | |
try { | |
$null = Enable-PSRemoting -Force -ErrorAction Stop | |
} | |
catch { |
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
<# | |
.SYNOPSIS | |
Manages a MobyLinux VM to run Linux Docker on Hyper-V | |
.DESCRIPTION | |
Creates/Destroys/Starts/Stops A MobyLinux VM to run Docker on Hyper-V | |
.PARAMETER VmName | |
If passed, use this name for the MobyLinux VM, otherwise 'MobyLinuxVM' |
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
PS C:\Users\zeroadmin> $636Test = Get-LDAPCert -LDAPServerHostNameOrIP ZeroDC02.zero.lab -Port 636 | |
PS C:\Users\zeroadmin> $636Test | fl * | |
LDAPEndpointCertificateInfo : @{X509CertFormat=[Subject] | |
CN=ZeroDC02.zero.lab | |
[Issuer] | |
CN=ZeroDC01, O=ZERO, C=LAB |
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
# Example Usage: | |
# PS C:\Users\testadmin> $CurrentTokens = Get-VaultTokens -VaultBaseUri "http://192.168.2.12:8200/v1" -VaultAuthToken "myroot" | |
# PS C:\Users\testadmin> $CurrentTokens | |
function Get-VaultTokens { | |
[CmdletBinding()] | |
Param( | |
[Parameter(Mandatory=$True)] | |
[string]$VaultBaseUri, # Should be something like "http://192.168.2.12:8200/v1" | |
[Parameter(Mandatory=$True)] |
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
PS C:\Users\pdadmin> Get-NetNatExternalAddress | |
ExternalAddressID : 0 | |
NatName : ICS74e71ad9-651a-4d18-98f0-5fd67522ede4 | |
IPAddress : 127.0.0.1 | |
PortStart : 49708 | |
PortEnd : 49717 | |
Active : True |
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 Start-DockerAfterReboot { | |
[CmdletBinding()] | |
Param( | |
[Parameter(Mandatory=$False)] | |
[switch]$SkipPrompt | |
) | |
if (!$(Check-Elevation)) { | |
Write-Error "The $($MyInvocation.MyCommand.Name) function must be run with elevated privileges (i.e. start PowerShell with 'Run As Administrator'). Halting!" | |
$global:FunctionResult = "1" |
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
# dhcpd.conf | |
# option definitions common to all supported networks... | |
option domain-name "random.lab"; | |
option domain-name-servers 8.8.8.8; | |
option option-128 code 128 = string; | |
option option-129 code 129 = text; | |
default-lease-time 600; | |
max-lease-time 7200; |
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 Test-Func { | |
try { | |
$NewVagrantBoxResult = New-VagrantBox -VagrantBox "centos/7" -ErrorVariable NVBErr -ErrorAction SilentlyContinue | |
if (!$NewVagrantBoxResult) {throw "The New-VagrantBox function failed!"} | |
$NewVagrantBoxResult | |
} | |
catch { | |
Write-Error $_ | |
Write-Error $($NVBErr | Out-String) |
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
PS C:\Users\zeroadmin> Get-VMSwitch -Name ToInternal | fl * | |
Name : ToInternal | |
Id : 2302da2b-bf3c-42eb-93f7-4e37fa7da892 | |
Notes : | |
Extensions : {Microsoft Windows Filtering Platform, Microsoft Azure VFP Switch Extension, Microsoft NDIS Capture} | |
BandwidthReservationMode : Absolute | |
PacketDirectEnabled : False | |
EmbeddedTeamingEnabled : False | |
IovEnabled : False |