Skip to content

Instantly share code, notes, and snippets.

View ploegert's full-sized avatar
💭
¯\_(ツ)_/¯

Justin Ploegert ploegert

💭
¯\_(ツ)_/¯
View GitHub Profile
@ploegert
ploegert / Get-AzureVPNDiag.ps1
Created June 12, 2015 13:28
Azure VPN Tunnel Diagnostics
function Write-Log
{
param(
[Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)]
[AllowEmptyString()]
[string]
$Message
)
Write-Verbose -Verbose ("[{0:s}] {1}`r`n" -f (get-date), $Message)
@ploegert
ploegert / Import-AllModules.ps1
Created June 25, 2015 13:34
Import all Powershell modules
Get-Module -ListAvailable | Import-Module
#You can also use aliases:
gmo -l | ipmo
@ploegert
ploegert / Enable-Skype.ps1
Created June 25, 2015 13:54
Setup Skype Online Connector
$path = "HKCU:\Software\Microsoft\Office\Lync"
$prop = "EnableSkypeUI"
$value = "1"
Set-ItemProperty -Path $path -Name $prop -Value $value
@ploegert
ploegert / Get-AzureVMImages.ps1
Last active September 16, 2015 19:16
Get azure VM Images ASM identifies the source image used to create a VM by the name of the VHD containing the image. ARM supports a new way to identify the source image for a VM, based on: Publisher name SKU Version ARM supports the following cmdlets for source images: src: http://blogs.msdn.com/b/cloud_solution_architect/archive/2015/05/05/crea…
<#
ASM identifies the source image used to create a VM by the name of the VHD containing the image. ARM supports a new way to identify the source image for a VM, based on:
Publisher name
SKU
Version
ARM supports the following cmdlets for source images:
#>
Save-AzureVMImage – save a custom image
@ploegert
ploegert / get-dotNetVersion.ps1
Last active August 29, 2015 14:24
Get .NET version that is currently deployed
Function Get-dotNetVersion
{
$installedDotNet = Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full" | Select-Object -ExpandProperty Release -ErrorAction Stop
switch ($installedDotNet)
{
393273 { $ret = "4.6 RC" }
381029 { $ret = "4.6 RC-older" }
379893 { $ret = "4.5.2" }
378675 { $ret = "4.5.1" }
@ploegert
ploegert / Get-DSCStatus.ps1
Last active August 29, 2015 14:24
Get DSC Extension Status
$resourceGroup = $vars.ResourceGroupName;
$VMName = "memuat-web0"
$ab = Get-AzureVMExtension -ResourceGroupName $resourceGroup -VMName $VMName -ExtensionName dscscript -Status
$ab | out-string
$ab.Statuses
@ploegert
ploegert / AADSCWebConfig.ps1
Last active March 2, 2022 13:16
DSC Config for Web Server
Configuration WebSiteConfig
{
# Import DSC WebAdmin Module from DSC Resource Kit
Import-DscResource -ModuleName xWebAdministration
Node ("localhost")
{
# Install the Web Server role
@ploegert
ploegert / Get-RDP.ps1
Created July 14, 2015 15:26
ACQUIRING REMOTE ACCESS TO OUR VM Since we know the name of your VM we can simply use Azure SDK cmdlets to get RDP file and kick off a remote access to it. See Azure Powershell SDK documentation for more information. src: http://blogs.msdn.com/b/powershell/archive/2014/08/07/introducing-the-azure-powershell-dsc-desired-state-configuration-extens…
$vm = Get-AzureVM –ServiceName "example-1-svc" –Name "example-1"
$rdp = Get-AzureEndpoint -Name "RDP" -VM $vm
$hostdns = (New-Object "System.Uri" $vm.DNSName).Authority
$port = $rdp.Port
Start-Process "mstsc" -ArgumentList "/V:$hostdns`:$port /w:1024 /h:768
@ploegert
ploegert / CreateTSDB.sh
Created July 14, 2015 15:33
Shell Script to setup & install TSDB
#
# ConfigTSDB.sh
#
install_prereqs()
{
sudo bash
cd /home/jciazdeploy
apt-get update -y
@ploegert
ploegert / Publish-DSC-ToAzureStorage.ps1
Created July 14, 2015 15:39
Publish PowerShell DSC Configuration to Azure Storage Account After saving the DSC Configuration as a local PowerShell script file, we'll need to publish this configuration to an Azure Storage Account container so that the Azure VMs we are provisioning will be able to access it. To perform this publishing process, we'll use the Azure PowerShell …
# Authenticate to Azure
Add-AzureAccount
# Select Azure Subscription and Storage Account
$subscriptionName = (Get-AzureSubscription).SubscriptionName |
Out-GridView `
-Title "Select Your Azure Subcription" `
-PassThru
Select-AzureSubscription `