Skip to content

Instantly share code, notes, and snippets.

View jonathanmedd's full-sized avatar

Jonathan Medd jonathanmedd

View GitHub Profile
@jonathanmedd
jonathanmedd / Get-Command-Module-PowervRA.ps1
Created April 1, 2020 15:59
Get-Command-Module-PowervRA
Get-Command -Module PowervRA
CommandType Name Version Source
----------- ---- ------- ------
Function Connect-vRAServer 4.0.0 PowervRA
Function Disconnect-vRAServer 4.0.0 PowervRA
Function Get-vRAAPIVersion 4.0.0 PowervRA
Function Get-vRACloudAccount 4.0.0 PowervRA
Function Get-vRACloudZone 4.0.0 PowervRA
@jonathanmedd
jonathanmedd / Install-PowervRA-Latest.ps1
Created April 1, 2020 15:55
Install-PowervRA-Latest
Install-Module -Name PowervRA -Scope CurrentUser
@jonathanmedd
jonathanmedd / Install-PowervRA-3-7-0.ps1
Last active April 6, 2020 08:52
Install-PowervRA-3-7-0
Install-Module -Name PowervRA -RequiredVersion 3.7.0 -Scope CurrentUser
@jonathanmedd
jonathanmedd / PowerShell_Parallel_Example_GitHubUsers.ps1
Created January 23, 2020 16:19
PowerShell Parallel Example GitHubUsers
$users = Invoke-RestMethod -Uri 'https://api.github.com/users'
$users | ForEach-Object -Parallel {
Write-Output "GitHub User $($_.login) has ID $($_.id)"
$Seconds = (Get-Random -Minimum 1 -Maximum 10)
Start-Sleep -Seconds $Seconds
}
@jonathanmedd
jonathanmedd / PowerShell_Runspace_Example_GitHubUsers.ps1
Last active January 23, 2020 16:14
PowerShell Runspace Example GitHubUsers
# Modified Example From: https://blog.netnerds.net/2016/12/runspaces-simplified/
$users = Invoke-RestMethod -Uri 'https://api.github.com/users'
$pool = [RunspaceFactory]::CreateRunspacePool(1, 5)
$pool.ApartmentState = "MTA"
$pool.Open()
$runspaces = @()
$scriptblock = {
@jonathanmedd
jonathanmedd / VM_dependency_restart_condition.ps1
Created January 21, 2020 15:24
VM dependency restart condition
$cluster = Get-Cluster -Name "MyCluster"
$spec = New-Object VMware.Vim.VMware.Vim.ClusterConfigSpecEx
$spec.orchestration = New-Object VMware.Vim.ClusterOrchestrationInfo
$spec.orchestration.defaultVmReadiness = New-Object VMware.Vim.ClusterVmReadiness
$spec.orchestration.defaultVmReadiness.readyCondition = 'guestHbStatusGreen'
$modify = $true
$cluster.ExtensionData.ReconfigureCluster($spec,$modify)
@jonathanmedd
jonathanmedd / test_output4.ps1
Created January 6, 2020 17:45
test_output4
Get-ChildItem test
$ErrorDetail = Get-Error
Write-Output ($ErrorDetail.CategoryInfo | ConvertTo-Json)
@jonathanmedd
jonathanmedd / _test_pwsh7.yml
Last active March 4, 2020 18:19
_test_pwsh7
---
- hosts: all
tasks:
- name: Run a script
shell: "{{ playbook_dir }}/files/test_output4.ps1"
args:
executable: /usr/bin/pwsh
register: result1
@jonathanmedd
jonathanmedd / _14_install_chocolatey_packages.yml
Created December 6, 2019 16:31
_14_install_chocolatey_packages
---
- hosts: all
tasks:
- name: Install package dependencies
win_chocolatey:
name:
- chocolatey-core.extension
- chocolatey-windowsupdate.extension
state: present
@jonathanmedd
jonathanmedd / _13_registry_entries.yml
Created December 6, 2019 13:54
_13_registry_entries
---
- hosts: all
tasks:
- name: Create Registry Entry FileNotFoundCacheEntriesMax
win_regedit:
path: HKLM:\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters
name: FileNotFoundCacheEntriesMax
data: 2000
type: dword