Skip to content

Instantly share code, notes, and snippets.

View adamrushuk's full-sized avatar

Adam Rush adamrushuk

View GitHub Profile
# Author: Adam Rush
# Created on: 2016-05-28
# Finds all upgradeable vShield Edges and exports CSV file to Desktop
$reportPath = "$HOME\Desktop\upgradable-VSEs.csv"
$report = @()
Write-Host "Searching for all vShield Edges..." -ForegroundColor Yellow
$edges = Get-View -ViewType virtualmachine -Property Name,Config -Filter @{'Config.VAppConfig.Product[0].Name'='vShield Edge'} | % {
$edge = '' | Select 'Name','Version'
$edge.Name = $_.Name
# Variables
$powershellGetVersion = '1.5.0.0' # DO NOT use the latest 1.6.0 version as there is issues with this process
$moduleFolderPath = 'C:\path\to\PowerShell\Module\FOLDER' # only target folder, NOT the .psm1 or .psd1
$repositoryName = 'psmodules'
$feedUsername = 'NotChecked'
$PAT = 'abcdefghijklmnopqrstuv1234567890' # Enter your Personal Access Token
$packageSourceUrl = "https://ACCOUNTNAME.pkgs.visualstudio.com/_packaging/$repositoryName/nuget/v2" # Enter your VSTS AccountName (note: v2 Feed)
# This is downloaded during Step 3, but could also be "C:\Users\USERNAME\AppData\Local\Microsoft\Windows\PowerShell\PowerShellGet\NuGet.exe"
# if not running script as Administrator.
@adamrushuk
adamrushuk / Get-GuidFromMsiFile.ps1
Last active March 22, 2024 22:59
Getting the Product ID / GUID from MSI file
# Vars
$msiPath = 'C:\Users\arush\Downloads\sqlncli.msi'
# Definition
$sig = @'
[DllImport("msi.dll", CharSet = CharSet.Unicode, PreserveSig = true, SetLastError = true, ExactSpelling = true)]
private static extern UInt32 MsiOpenPackageW(string szPackagePath, out IntPtr hProduct);
[DllImport("msi.dll", CharSet = CharSet.Unicode, PreserveSig = true, SetLastError = true, ExactSpelling = true)]
private static extern uint MsiCloseHandle(IntPtr hAny);
[DllImport("msi.dll", CharSet = CharSet.Unicode, PreserveSig = true, SetLastError = true, ExactSpelling = true)]
#!/bin/bash
# Installs Ansible AWX
echo "INFO: Started Installing Ansible AWX..."
# Install prereq: Docker SDK for Python
echo "INFO: Started Installing Docker SDK for Python..."
pip install docker
echo "INFO: Finished Installing Docker SDK for Python."
@adamrushuk
adamrushuk / azure_ansible_credentials.yml
Last active January 10, 2019 13:53
Vagrant provisioning scripts for Azure / Ansible blog post: https://adamrushuk.github.io/azure-provisioning-ansible-awx/
---
# Update with your Azure Service Principal credentials
subscription: "aaaa1111-bbbb-cccc-abcd-aaabbbcccddd"
client: "abcd1234-abcd-efff-1234-abcd12345678"
secret: "MyStrongPassw0rd!"
tenant: "12345678-ab12-cd34-ef56-1234abcd5678"
@adamrushuk
adamrushuk / 01-Boxstarter.ps1
Last active July 14, 2021 07:01
New Computer Configuration Scripts - run each script in order
# Install Boxstarter and Chocolatey
Set-ExecutionPolicy -ExecutionPolicy "RemoteSigned" -Verbose
. { iwr -useb https://boxstarter.org/bootstrapper.ps1 } | iex; get-boxstarter -Force
# Set Explorer options
Set-WindowsExplorerOptions -EnableShowHiddenFilesFoldersDrives -EnableShowProtectedOSFiles -EnableShowFileExtensions -EnableShowFullPathInTitleBar -DisableOpenFileExplorerToQuickAccess -DisableShowRecentFilesInQuickAccess -DisableShowFrequentFoldersInQuickAccess -DisableExpandToOpenFolder -DisableShowRibbon
# Set Taskbar options
Set-TaskbarOptions -Size Large -Lock -Dock Bottom -Combine Always
@adamrushuk
adamrushuk / ConfigureAzureForSecureTerraformAccess.ps1
Created February 17, 2019 17:41
Configures Azure for secure Terraform access. Loads Azure Key Vault secrets into Terraform environment variables for the current PowerShell session.
<#
.SYNOPSIS
Configures Azure for secure Terraform access.
.DESCRIPTION
Configures Azure for secure Terraform access using Azure Key Vault.
The following steps are automated:
- Creates an Azure Service Principle for Terraform.
- Creates a new Resource Group.
- Creates a new Storage Account.
@adamrushuk
adamrushuk / KeePass.ps1
Created March 17, 2019 14:24
KeePass PowerShell examples
#Requires -RunAsAdministrator
# Testing KeePass automation against KeePass v2.39.1
# Vars
$masterKeyCredential = New-Object -TypeName 'PSCredential' -ArgumentList ('KPMasterUser', (ConvertTo-SecureString -String 'Passw0rd123!' -AsPlainText -Force))
$repoPath = 'C:\Code\KeePass\KeePassDB'
$databaseName = 'KeePassDatabase'
$databasePath = Join-Path -Path $repoPath -ChildPath "$databaseName.kdbx"
$databaseProfileName = 'KeePassDatabaseProfile01'
$testGroupName = 'TestAccounts'
@adamrushuk
adamrushuk / Publish-AzDOArtifactFeed.ps1
Created June 20, 2019 20:54
Publish a PowerShell Module to an Internal Azure DevOps Artifacts feed
[CmdletBinding()]
param (
[string]$AzDOAccountName = 'adamrushuk',
[string]$AzDOArtifactFeedName = 'dev',
[string]$AzDOPat,
[string]$ModuleFolderPath = (Join-Path -Path $env:SYSTEM_ARTIFACTSDIRECTORY -ChildPath "PowerShellPipeline\PSModule\PSvCloud")
)
# Variables
$feedUsername = 'NotChecked'
#!/bin/bash
# Set GitLab pipeline status
# vars
GITLAB_URL="https://gitlab.domain.com"
GITLAB_TOKEN="<your_access_token>"
# status can be one of: running, pending, success, failed, canceled, skipped, created, manual
STATUS="success"
# get required info