This file contains 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
# This script is intended to configure Hyper-V on a Windows 10 machine where virtual disks are already present. | |
Configuration testbox | |
{ | |
Import-DscResource -module xHyper-V, xDismFeature | |
Node localhost | |
{ | |
xDismFeature HyperV | |
{ | |
Ensure = 'Present' |
This file contains 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
$LastStatus = (Get-DscConfigurationStatus).StartDate | |
$Frequency = (Get-DscLocalConfigurationManager).ConfigurationModeFrequencyMins | |
while ( (Get-Date) -lt ($LastStatus.AddMinutes($Frequency)) ) | |
{ | |
Write-Host ((Get-Date) - ($LastStatus.AddMinutes($Frequency))) | |
} |
This file contains 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
# https://gallery.technet.microsoft.com/scriptcenter/Convert-WindowsImageps1-0fe23a8f | |
# Update line 3044 | |
# In version 6.3, the evaluator was comparing strings to integers. | |
# Replacing this line will use version objects to check the version of Windows and integers for the build number. | |
$isWin8 = (((new-object Version $os.Version) -ge (new-object Version 6.2)) -and ([uint32]$os.BuildNumber -ge $lowestSupportedBuild)) |
This file contains 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
# This function is meant to simplify a check against a DSC Pull Server. If you do not use the default service URL, you will need to adjust accordingly. | |
function Verify-DSCPullServer ($fqdn) { | |
([xml](invoke-webrequest "https://$($fqdn):8080/psdscpullserver.svc" | % Content)).service.workspace.collection.href | |
} | |
Verify-DSCPullServer 'INSERT SERVER FQDN' |
This file contains 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 fixcursor | |
{ | |
[console]::CursorSize = 25 | |
} |
This file contains 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 Run { | |
param ( | |
[parameter (mandatory = $true, valuefrompipeline = $true)] | |
[system.string]$Runbook, | |
[system.string]$AutomationAccount | |
) | |
if (!(Get-Module Azure)) {ipmo 'C:\Program Files (x86)\Microsoft SDKs\Azure\PowerShell\ServiceManagement\Azure\Azure.psd1'} | |
if (!$AutomationAccount) {$AutomationAccount = Get-AzureAutomationAccount | % AutomationAccountName} | |
Start-AzureAutomationRunbook -Name $Runbook -AutomationAccountName $AutomationAccount | |
} |
This file contains 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
$modules = 'C:\Program Files\WindowsPowerShell\Modules\' | |
$modulename = 'xName' | |
$Description = 'Some Text' | |
if (!(test-path (join-path $modules $modulename))) { | |
$modulefolder = mkdir (join-path $modules $modulename) | |
New-ModuleManifest -Path (join-path $modulefolder "$modulename.psd1") -Guid $([system.guid]::newguid().guid) -Author 'Author' -CompanyName 'Company Name' -Copyright '2015' -ModuleVersion '0.1.0.0' -Description $Description -PowerShellVersion '4.0' | |
$standard = @{ModuleName = $modulename |
This file contains 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
Configuration CA | |
{ | |
param ( | |
[Parameter(Mandatory=$true)] | |
[ValidateNotNullorEmpty()] | |
[PsCredential] $credential | |
) | |
Import-DSCResource -module xAdcsDeployment | |
Node 'localhost' | |
{ |
This file contains 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
# This is an advanced Configuration example for Pull Server production deployments on Windows Server 2012 R2. | |
# Many of the features demonstrated are optional and provided to demonstrate how to adapt the Configuration for multiple scenarios | |
# Select the needed resources based on the requirements for each environment. | |
# Optional scenarios include: | |
# * Reduce footprint to Server Core | |
# * Rename server and join domain | |
# * Switch from SSL to TLS for HTTPS | |
# * Automatically load certificate from Certificate Authority | |
# * Locate Modules and Configuration data on remote SMB share | |
# * Manage state of default websites in IIS |
This file contains 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 Connect { | |
param ( | |
[parameter (mandatory = $true)] | |
[system.string]$vm, | |
[parameter (mandatory = $true)] | |
[system.string]$service, | |
[parameter (mandatory = $true, valuefrompipeline = $true)] | |
[pscredential]$cred | |
) | |
$Services = Get-AzureService | % ServiceName |