Skip to content

Instantly share code, notes, and snippets.

############################################################
# Dockerfile Downcount ASP.NET Core Service
# Based on Ubuntu
############################################################
# Set the base image to Ubuntu
FROM microsoft/aspnetcore:lts
# File Author / Maintainer
MAINTAINER sd software
<#
.SYNOPSIS
Start or stop the specfied ARM VMs in parallel using background jobs
.DESCRIPTION
Start or stop the specfied ARM VMs in parallel using background jobs
.PARAMETER Subscription
The Azure subscription
cls
$numThreads = 5
$ScriptBlock = {
Param (
[string]$string1,
[string]$string2
)
$concatenatedString = "$string1$string2"
return New-Object PSObject -Property @{
cls
# create an array and add it to session state
$arrayList = New-Object System.Collections.ArrayList
$arrayList.AddRange(('a','b','c','d','e'))
$sessionstate = [system.management.automation.runspaces.initialsessionstate]::CreateDefault()
$sessionstate.Variables.Add(
(New-Object System.Management.Automation.Runspaces.SessionStateVariableEntry('arrayList', $arrayList, $null))
)
cls
$scriptPath = split-path -parent $MyInvocation.MyCommand.Definition
$folderLocation = [System.IO.Path]::Combine($scriptPath, "PowerShellMultiThreading_LockExample")
if (Test-Path $folderLocation)
{
Remove-Item $folderLocation -Recurse -Force
}
New-Item -Path $folderLocation -ItemType directory -Force > $null
$summaryFile = [System.IO.Path]::Combine($folderLocation, "summaryfile.txt")
cls
$scriptPath = split-path -parent $MyInvocation.MyCommand.Definition
$folderLocation = [System.IO.Path]::Combine($scriptPath, "PowerShellMultiThreading_SimpleExample")
if (Test-Path $folderLocation)
{
Remove-Item $folderLocation -Recurse -Force
}
New-Item -Path $folderLocation -ItemType directory -Force > $null
# This script block will download a file from the web and create a local version
$Credential = Get-Credential
StartStop-AzureRMVMsWorkflow.ps1 `
-Subscription "mySubscription" `
-Credential $Credential `
-ResourceGroupName "myResourceGroupName" `
-VMNames "VMName1", "VMName2", "VMName3" `
-Action Stop
<#
.SYNOPSIS
Start or stop the specfied ARM VMs in parallel using background jobs
.DESCRIPTION
Start or stop the specfied ARM VMs in parallel using background jobs
.PARAMETER Subscription
The Azure subscription
$profilePath = "C:\profiles\profile.json"
Save-AzureRmProfile -Path $profilePath -Force
StartStop-AzureRmVmsUsingBackgroundJobs.ps1 `
-Subscription "mySubscription" `
-ProfilePath $profilePath `
-ResourceGroupName "myResourceGroupName" `
-VMNames "vmName1", "vmName2", "vmName3" `
-Action Stop
<#
.SYNOPSIS
Start or stop the specfied ARM VMs in parallel using background jobs
.DESCRIPTION
Start or stop the specfied ARM VMs in parallel using background jobs
.PARAMETER Subscription
The Azure subscription