Skip to content

Instantly share code, notes, and snippets.

@{
# Script module or binary module file associated with this manifest
ModuleToProcess = 'Microsoft.ResourceManagement.Automation.dll'
# Version number of this module.
ModuleVersion = '1.0'
# ID used to uniquely identify this module
GUID = '73fec12a-fd2a-4ffc-a9e3-9ad6f78bf78b'
function Show-Message
{
[cmdletbinding()]
Param(
[Parameter(ValueFromPipeLine)]
$Message
,
[Parameter(ParameterSetName="Win10")]
$DisplayDuration = 10
,
{
"itemDisplayName": "Blank Template",
"description": "A blank template and empty parameters file.",
"summary": "A blank template and empty parameters file. Use this template as the framework for your custom deployment.",
"githubUsername": "bmoore-msft",
"dateUpdated": "2016-09-28"
}
# Create a new empty template
New-ArmTemplate
# Creates a new variable named Region
New-ARMvariable -Name Region -Value "East US" | Add-ARMvariable
$newVar = @{
Name = "Region2"
Value = "North Europe"
}
# Import an ARM template from file
Import-ARMtemplate -FileName C:\tmp\armTemplate.json
# Import an ARM template from the clipboard
Get-Clipboard | Import-ARMtemplate
$resource = @{
type = "Microsoft.Storage/storageAccounts"
name = "StorageSimpleVM"
apiVersion = "2016-01-01"
location = "North Europe"
sku = @{
name = "Standard_LRS"
}
kind = "Storage"
properties = @{}
$newParm = @{
Name = 'adminUsername'
Type = 'string'
Description = 'Username for the Virtual Machine.'
}
# Creates a new parameter named adminUsername
New-ARMparameter @newParm | Add-ARMparameter
# Create a new empty template
New-ArmTemplate
# Creates a new variable named Region
New-ARMvariable -Name Region -Value "East US" | Add-ARMvariable
$newVar = @{
Name = "Region2"
Value = "North Europe"
}
Configuration ChangeDescriptionConfig
{
Import-DscResource -Name MSFT_xSmbShare
# A Configuration block can have zero or more Node blocks
Node localhost
{
xSmbShare MySMBShare
{
Ensure = "Present"
Name = "MyShare"
# Added from http://bretty.me.uk/save-money-using-citrix-octoblu-automation-for-power-management/
# Author: Dave Brett
function Lab-Startup {
$ErrorActionPreference = 'Continue'
import-module XenServerPSModule
connect-xenserver -url http://xs.bretty.local -username USERNAME -password PASSWORD
$file = "c:\Scripts\vmlist.txt"
$VMNames = Get-Content $file
foreach($VMName in $VMNames)
{