Skip to content

Instantly share code, notes, and snippets.

View vhusker's full-sized avatar

Jacob Benson vhusker

  • Ardalyst
  • Omaha, NE
View GitHub Profile
@vhusker
vhusker / resourcekeymodifiedfile.ps1
Last active August 26, 2015 11:31
Resource Key Error /w Modified File Resource
Configuration BuildHyperVHost{
Param(
[string]$DeploymentFilesPath,
[string]$DestinationPath
)
Import-DSCResource -ModuleName @{ModuleName="xComputerManagement";ModuleVersion="1.3.0"}
node localhost{
@vhusker
vhusker / resourcekeysyntax.ps1
Created August 26, 2015 11:23
Resource Key Syntax
Get-DSCResource File -Synatx
File [String] #ResourceName
{
DestinationPath = [string]
[Attributes = [string[]]{ Archive | Hidden | ReadOnly | System }]
[Checksum = [string]{ CreatedDate | ModifiedDate | SHA-1 | SHA-256 | SHA-512 }]
[Contents = [string]]
[Credential = [PSCredential]]
[DependsOn = [string[]]]
[Ensure = [string]{ Absent | Present }]
@vhusker
vhusker / resourcekeymodifiedconfiguration.ps1
Created August 26, 2015 11:19
Resource Key w/ Computer Name
Configuration BuildHyperVHost{
Param(
[string]$ComputerName="blah",
[string]$HostIPAddress,
[string]$DeploymentFilesPath,
[string]$BaseVHDFile,
[string]$DestinationDrive
)
@vhusker
vhusker / resourcekeyconfiguration.ps1
Created August 26, 2015 11:14
Resource Key error Parameters
Configuration BuildHyperVHost{
Param(
[string]$ComputerName,
[string]$HostIPAddress,
[string]$DeploymentFilesPath,
[string]$BaseVHDFile,
[string]$DestinationDrive
)
@vhusker
vhusker / resourcekey.ps1
Last active August 26, 2015 11:28
Cannot Bind argument to Resource Key because it's an empty string
PSDesiredStateConfiguration\node : Cannot bind argument to parameter 'ResourceKey' because it is an empty string.
At C:\Temp\Build Hyper-V Host.ps1:15 char:5
+ node localhost
+ ~~~~
+ CategoryInfo : InvalidData: (:) [PSDesiredStateConfiguration\node], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : ParameterArgumentValidationErrorEmptyStringNotAllowed,PSDesiredStateConfiguration\node
Update-DependsOn : Index operation failed; the array index evaluated to null.
At C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\PSDesiredStateConfiguration\PSDesiredStateConfiguration.psm1:2208 char:17
+ ... Update-DependsOn $Script:NodesInThisConfiguration[$mofNod ...
@vhusker
vhusker / Import-Module -Name Azure Breaks ISE
Created May 19, 2015 13:33
Import-Module -Name Breaks ISE
$> $PSVersionTable
Name Value
---- -----
PSVersion 5.0.10074.0
WSManStackVersion 3.0
SerializationVersion 1.1.0.1
CLRVersion 4.0.30319.0
@vhusker
vhusker / gist:eaf1670f333c9c0518e1
Last active August 29, 2015 14:21
Azure TFS Deployment w/DSC Extension Failure
VERBOSE: [2015-05-15T19:52:37] File lock does not exist: begin processing
VERBOSE: [2015-05-15T19:52:37] Installing the DSC Extension...
VERBOSE: [2015-05-15T19:52:37] Creating
C:\Packages\Plugins\Microsoft.Powershell.DSC\1.9.0.0\bin\..\DSCWork\1-InProgress.Install.dsc...
VERBOSE: [2015-05-15T19:52:37] Reading handler environment from
C:\Packages\Plugins\Microsoft.Powershell.DSC\1.9.0.0\bin\..\HandlerEnvironment.json
VERBOSE: [2015-05-15T19:52:38] Writing handler status to C:\Packages\Plugins\Microsoft.Powershell.DSC\1.9.0.0\Status\0.status
VERBOSE: [2015-05-15T19:52:40] File
C:\Packages\Plugins\Microsoft.Powershell.DSC\1.9.0.0\bin\..\DSCWork\1-InProgress.Install.dsc exists; install in progress.
VERBOSE: [2015-05-15T19:52:40] Installing DSC Extension...
@vhusker
vhusker / gist:412f1017daefa442c932
Created March 13, 2015 14:27
Get combined desktop size of all users on a Terminal Server
#This can definitely be condensed into a line or two but this is a good illustration of the way I worked my way through this task
$DesktopFolders = Get-ChildItem -Path C:\Users\*\Desktop -Recurse
$DesktopFoldersSize = $DesktopFolders | Measure-Object -Property Length -Sum
$DesktopFolderSize
Count : 16072
Average :
Sum : 22536515116
Maximum :
Minimum :
@vhusker
vhusker / BuildWebServer
Last active March 12, 2016 16:43
Build Web Server for a DSC Demo
$ConfigData =@{
AllNodes = @(
@{
NodeName = "localhost"
PSDSCAllowPlainTextPassword = $True
}
)
}
@vhusker
vhusker / AppServerLCM
Created March 10, 2015 12:33
Set App Server Local Configuration
Configuration PushLCMConfig{
param(
[parameter(Mandatory=$True)]
[ValidateNotNullorEmpty()]
[string]$ComputerName
)
Node $ComputerName{