This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| READING LOGS | |
| Let us say that I wish to check in detail that everything went well on my VM. How would I do that? I can log in to my VM from Azure and check the local logs. The files of interest to us will be the following two locations on VM hard drive: | |
| C:\Packages\Plugins\Microsoft.Powershell.DSC\1.0.0.0 | |
| C:\WindowsAzure\Logs\Plugins\Microsoft.Powershell.DSC\1.0.0.0 | |
| You may find that your VM has a newer version of Powershell DSC extension,in which case the version number at the end of the path might be slightly different. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #File: C:\examples\IISInstall.ps1 | |
| configuration IISInstall | |
| { | |
| node ("localhost") | |
| { | |
| WindowsFeature IIS | |
| { | |
| Ensure = "Present" | |
| Name = "Web-Server" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <# | |
| Let's say we want to ensure that a virtual machine has a local user with certain credentials. | |
| We’ll create a new configuration, located in the file user_configuration.ps1: | |
| #> | |
| configuration Main | |
| { | |
| param( | |
| [Parameter(Mandatory=$true)] | |
| [ValidateNotNullorEmpty()] | |
| [PSCredential] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Add-AzureAccount | |
| $SubName = "be-dev" | |
| Set-AzureSubscription -SubscriptionName $SubName | |
| Select-AzureSubscription -SubscriptionName $SubName | |
| $workingDir = "P:\posh\config\BE-Dev\VMs" | |
| $vmName = "eisdev-dc01" | |
| $serviceName = "eisdev-dc" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Get-DnsClientServerAddress | |
| Set-DNSClientServerAddress -InterfaceAlias "Ethernet" –ServerAddresses ("DNS1","DNS2") | |
| Get-DnsClientServerAddress | |
| $domain = "DOMAIN" | |
| $password = "PASSWORD" | ConvertTo-SecureString -asPlainText -Force | |
| $username = "$domain\USER" | |
| $credential = New-Object System.Management.Automation.PSCredential($username,$password) | |
| Add-Computer -DomainName $domain -Credential $credential |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function Edit-XmlNodes { | |
| param ( | |
| [xml] $doc = $(throw "doc is a required parameter"), | |
| [string] $xpath = $(throw "xpath is a required parameter"), | |
| [string] $value = $(throw "value is a required parameter"), | |
| [bool] $condition = $true | |
| ) | |
| if ($condition -eq $true) { | |
| $nodes = $doc.SelectNodes($xpath) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Retrieve all available items | |
| $allGalleryItems = Invoke-WebRequest -Uri "https://gallery.azure.com/Microsoft.Gallery/GalleryItems?api-version=2015-04-01&includePreview=true" | ConvertFrom-Json | |
| # Get all items published by Microsoft | |
| $allGalleryItems | Where-Object { $_.PublisherDisplayName -eq "Microsoft" } | |
| # Get all gallery items with "SQL" in the description | |
| $allGalleryItems | Where-Object { $_.Description -match "SQL" } | |
| # Save default template for all items under directory "C:\Templates" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Switch-AzureMode AzureResourceManager | |
| #Show all types | |
| (Get-AzureProvider).ResourceTypes | |
| #Get just the Compute Resource Types | |
| ((Get-AzureProvider) | Where-object { $_.ProviderNamespace -eq "Microsoft.Compute" }).resourceTypes | |
| ((Get-AzureProvider) | Where-object { $_.ProviderNamespace -eq "Microsoft.Network" }).resourceTypes |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <# | |
| .SYNOPSIS | |
| Create a configuration transformation | |
| .DESCRIPTION | |
| This script runs an ASP.NET configuration transformation, given a source | |
| configuration and transformation file. MSBuild.exe is assumed to be in | |
| the path, and Visual Studio 2012 should be installed. Modify the path to | |
| Microsoft.Web.Publishing.Tasks.dll if a different version of Visual Studio | |
| is installed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/zsh | |
| ### BEGIN INIT INFO | |
| # Provides: hubot | |
| # Required-Start: $all | |
| # Required-Stop: $all | |
| # Default-Start: 2 3 4 5 | |
| # Default-Stop: 0 1 6 | |
| # Short-Description: starts the hubot service | |
| # Description: starts the Hubot bot for the Campfire rooms |