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 TestDscResourceModule { | |
<# | |
.SYNOPSIS | |
Tests whether the specified PowerShell module directory is a DSC resource. | |
#> | |
[CmdletBinding()] | |
[OutputType([System.Boolean])] | |
param ( | |
[Parameter(Mandatory, ValueFromPipeline)] [System.String] $Path |
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
Measure-Command { | |
$SAMLogArrayList = New-Object -TypeName System.Collections.ArrayList -ArgumentList @() | |
$NumOfFiles = (Get-ChildItem -file $directory).count | |
$counter = 1 | |
Foreach($file in (Get-ChildItem -file $directory).FullName){ | |
$PercentComplete = (($counter / $NumOfFiles) * 100) | |
$PercentComplete = [math]::Round($PercentComplete, 2) | |
Write-Progress -id 1 -Activity "Reading Files." -PercentComplete $PercentComplete -CurrentOperation "$($PercentComplete)% complete" -Status "Please wait" | |
$LinesInFile = (Get-Content $file).count | |
$x = 1 |
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
Measure-Command { | |
$SAMLogArrayList = New-Object -TypeName System.Collections.ArrayList -ArgumentList @() | |
$NumOfFiles = (Get-ChildItem -file $directory).count | |
$counter = 1 | |
Foreach($file in (Get-ChildItem -file $directory).FullName) { | |
$PercentComplete = (($counter / $NumOfFiles) * 100) | |
$PercentComplete = [math]::Round($PercentComplete, 2) | |
Write-Progress -id 1 -Activity "Reading Files." -PercentComplete $PercentComplete -CurrentOperation "$($PercentComplete)% complete" -Status "Please wait" | |
$fileContent = Get-Content $file | |
for ($i = 0; $i -lt $fileContent.Count; $i++) |
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
#requires -RunAsAdministrator | |
#requires -Version 4.0 | |
[CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'Medium')] | |
param ( | |
## Name of the node in the PowerShell DSC configuration document (.psd1) to apply | |
[Parameter()] [ValidateNotNullOrEmpty()] | |
[System.String] $NodeName, | |
## Override the root path, i.e. when not running from an .Iso image |
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 Convert-HashToString { | |
[CmdletBinding()] | |
[OutputType([System.String])] | |
param ( | |
[Parameter(Mandatory, ValueFromPipeline, ValueFromPipelineByPropertyName)] | |
[System.Collections.Hashtable] $Hashtable, | |
[Parameter(ValueFromPipelineByPropertyName)] | |
[System.Int32] $Indentation, | |
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
## Register existing Windows 7 x64 Enterprise Evaluation VHD(X) media | |
$WIN7_x64_Enterprise_EN_Eval = @{ | |
Id = 'WIN7_x64_Enterprise_EN_Eval'; | |
Filename = 'WIN7_x64_Enterprise_EN_Eval_022016.vhdx'; | |
Description = 'Windows 7 Enterprise 64bit English Evaluation Patched 02/16'; | |
Architecture = 'x64'; | |
MediaType = 'VHD'; | |
Uri = '\\10.100.50.1\Public\ParentDisks\Win7_x64_Enterprise_EN_Eval_022016.vhdx'; | |
CustomData = @{ | |
PartitionStyle = 'MBR'; ## This creates a Gen1 VM |
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
## Set the default console colours | |
$Host.PrivateData.ErrorBackgroundColor = 'DarkMagenta'; | |
$Host.PrivateData.WarningBackgroundColor = 'DarkMagenta'; | |
$Host.PrivateData.VerboseForegroundColor = 'Cyan'; | |
$Host.PrivateData.VerboseBackgroundColor = 'DarkMagenta'; |
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
if (Test-Path -Path "$env:USERPROFILE\Dropbox\PowerShell" -PathType Container) { | |
if ($Host.Name -ne 'Visual Studio Code Host') { | |
## Always default to repository root when loading in VSCode | |
Set-Location -Path "$env:USERPROFILE\Dropbox\PowerShell"; | |
} | |
if (Test-Path -Path "$env:USERPROFILE\Dropbox\PowerShell\Modules" -PathType Container) { | |
if ($env:PSModulePath -notmatch "$(($env:USERPROFILE).Replace('\','\\'))\\Dropbox\\PowerShell\\Modules") { | |
$env:PSModulePath += ";$env:USERPROFILE\Dropbox\PowerShell\Modules"; |
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 Get-MofModule { | |
<# | |
.SYNOPSIS | |
Scans a Desired State Configuration .mof file and returns the declared/ | |
required modules. | |
#> | |
[CmdletBinding()] | |
param ( | |
[Parameter(Mandatory, ValueFromPipeline, ValueFromPipelineByPropertyName)] | |
[System.String] $Path |
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 Get-MofModule { | |
<# | |
.SYNOPSIS | |
Scans a Desired State Configuration .mof file and returns the declared/ | |
required modules. | |
#> | |
[CmdletBinding()] | |
param ( | |
[Parameter(Mandatory, ValueFromPipeline, ValueFromPipelineByPropertyName)] | |
[System.String] $Path |
OlderNewer