Skip to content

Instantly share code, notes, and snippets.

Marc Kean marckean

  • Microsoft
  • Sydney, Australia
Block or report user

Report or block marckean

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Ignite2019sessions.json
This file has been truncated, but you can view the full file.
[
{
"@search.score": 1.0,
"attendeeCount": 393,
"hasLiveStream": true,
"sessionId": "83014",
"sessionInstanceId": "83014",
"sessionCode": "THR3091",
"sessionCodeNormalized": "THR3091",
View Azure - Swap out VM resource.ps1
<#
Written with version 2.8.0 of the Azure PowerShell Module
available from here https://github.com/Azure/azure-powershell/releases/tag/v2.8.0-October2019
or run: Install-Module -Name Az -RequiredVersion 2.8.0 -AllowClobber
Migration instructions Azure.RM to Az - https://azure.microsoft.com/en-au/blog/how-to-migrate-from-azurerm-to-az-in-azure-powershell/
#>
#$resourceGroupName = Read-Host -Prompt "Enter the Resource Group name"
Add-AzAccount
View PowerShell_Azure_Module_Switcher.ps1
# Switch to the Azure AzureRM PowerShell module
if(Get-Module -Name Az*){
Remove-Module -Name Az*
Import-Module -Name AzureRM -Force}
# Switch to the Azure AZ PowerShell module (
if(Get-Module -Name AzureRM*){
Remove-Module -Name AzureRM*
Import-Module -Name Az -Force}
View PowerShellAzureFunction.ps1
using namespace System.Net
# Input bindings are passed in via param block.
param($Request, $TriggerMetadata)
# Write to the Azure Functions log stream.
Write-Host "PowerShell HTTP trigger function processed a request."
# Interact with query parameters or the body of the request.
$FirstName = $Request.Query.FirstName # Query based parameters
View Calling PowerShell Azure Functions v2.ps1
#########################################################
####### only works if the Route template is blank #######
#########################################################
# QUERY based parameter values - GET method
$firstName = 'Marc'
$surName = 'Kean'
$iwr = Invoke-WebRequest -Uri "https://ejuke2.azurewebsites.net/api/blog?firstname=$firstName&surname=$surName" -Method Get
$iwr.content
View Azure - Back up and restore Azure file shares.ps1
<#
Written with version 1.3.0 of the Az PowerShell Module
Run Get-InstalledModule to check installed modules
Install PowerShell Core 6 https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell-core-on-windows?view=powershell-6
The Az PowerShell Module is available from here https://github.com/Azure/azure-powershell/releases/tag/v1.4.0-February2019
... or run: Install-Module -Name Az -RequiredVersion 1.4.0 -AllowClobber
View Connect to WiFi network, using password.ps1
# Fill in mandatory details for the WiFi network
$WirelessNetworkSSID = '<WiFi_SSID>'
$WirelessNetworkPassword = '<WiFi_password>'
$Authentication = 'WPA2PSK' # Could be WPA2
$Encryption = 'AES'
# Create the WiFi profile, set the profile to auto connect
$WirelessProfile = @'
<WLANProfile xmlns="http://www.microsoft.com/networking/WLAN/profile/v1">
<name>{0}</name>
View AzureFunctions_PowerShell_Output HTML.ps1
# Setup the Azure Functions parameters
# https://marcfunction1.azurewebsites.net/api/sca/scanowplaying?state={state}
switch -RegEx ($REQ_QUERY_STATE)
{
\S {$state = $REQ_QUERY_STATE}
# https://marcfunction1.azurewebsites.net/api/sca/{state}
default {$state = $REQ_PARAMS_STATE}
}
View Windows 10 Adaptive Contrast.ps1
# Turn adaptive contrast on - default
$value = '9240'
New-ItemProperty -Path 'HKLM:\SYSTEM\ControlSet001\Control\Class\{4d36e968-e325-11ce-bfc1-08002be10318}\0001' `
-Name 'FeatureTestControl' -PropertyType DWORD -Value $value -Force
# Turn adaptive contrast off
$value = '9250'
New-ItemProperty -Path 'HKLM:\SYSTEM\ControlSet001\Control\Class\{4d36e968-e325-11ce-bfc1-08002be10318}\0001' `
-Name 'FeatureTestControl' -PropertyType DWORD -Value $value -Force
View Resource_Group_tags_to_children.ps1
##########################################################################################
###################### To be used with an Azure Automation runbook
###################### make sure you create the Automation Credential -Name 'AzureRunAsConnection'
###################### make sure you Automation Variable -Name 'SubscriptionID'
######################
##########################################################################################
# Thanks to https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-using-tags
$ServicePrincipalConnection = Get-AutomationConnection -Name 'AzureRunAsConnection'
You can’t perform that action at this time.