Skip to content

Instantly share code, notes, and snippets.

View nicholasdille's full-sized avatar

Nicholas Dille nicholasdille

View GitHub Profile

Keybase proof

I hereby claim:

  • I am nicholasdille on github.
  • I am nicholasdille (https://keybase.io/nicholasdille) on keybase.
  • I have a public key whose fingerprint is 6FA7 3A4F 40D9 5BFF 3338 8072 686E 1548 50D2 50F8

To claim this, I am signing this object:

@nicholasdille
nicholasdille / Test-ReturnFromFunction.ps1
Last active February 4, 2016 20:24
Demonstrated how a PowerShell advanced function behaves when trying to return
function Test-ReturnFromFunction {
[CmdletBinding()]
param(
[switch]
$ReturnFromBegin
,
[switch]
$ReturnFromProcess
,
[switch]
Verifying that +nicholasdille is my blockchain ID. https://onename.com/nicholasdille
@nicholasdille
nicholasdille / ConfigDataPester.ps1
Created November 25, 2015 09:29
Example of #PSDSC using #Pester for validating configuration data
$ConfigurationData = @{
AllNodes = @(
@{
NodeName = 'sql-01'
Roles = @{
Computer = @{
MachineName = 'sql-01'
DomainName = 'example.com'
Credential = 'Svc-Domain-Join@example.com'
}
@nicholasdille
nicholasdille / Install-WindowsUpdate.vbs
Created September 8, 2015 08:10
Installs Windows Updates asynchronously and displays progress
Set wshShell = WScript.CreateObject("WScript.Shell")
strComputerName = wshShell.ExpandEnvironmentStrings("%ComputerName%")
Set updateSession = CreateObject("Microsoft.Update.Session")
WScript.StdOut.WriteLine "Activity=""Processing Windows Updates on " & strComputerName & """ Status=""Searching for updates"" Percentage=0"
Set SearchResult = Search
WScript.StdOut.WriteLine "Activity=""Processing Windows Updates on " & strComputerName & """ Status=""Searching for updates"" Percentage=100"
WScript.StdOut.WriteLine "SearchResultCode=" & SearchResult.ResultCode
WScript.StdOut.WriteLine "UpdatesFound=" & SearchResult.Updates.Count
@nicholasdille
nicholasdille / ConvertTo-Progress.ps1
Created September 8, 2015 08:08
Reads progress information on standard output and displays progress bar
function ConvertTo-Progress {
[CmdletBinding()]
param(
[Parameter(Mandatory,ValueFromPipeline)]
[ValidateNotNullOrEmpty()]
[string[]]
$ProgressText
,
[Parameter()]
[ValidateNotNullOrEmpty()]
@nicholasdille
nicholasdille / Show-JobProgress.ps1
Last active December 30, 2021 20:38
Retrieve progress from PowerShell job and display progress bar
function Show-JobProgress {
[CmdletBinding()]
param(
[Parameter(Mandatory,ValueFromPipeline)]
[ValidateNotNullOrEmpty()]
[System.Management.Automation.Job[]]
$Job
,
[Parameter()]
[ValidateNotNullOrEmpty()]
@nicholasdille
nicholasdille / Invoke-Queue.ps1
Created September 8, 2015 08:03
Process a queue of objects using PowerShell jobs
function Invoke-Queue {
[CmdletBinding()]
[OutputType([System.Management.Automation.Job[]])]
param(
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[System.Object[]]
$InputObject
,
[Parameter(Mandatory)]
@nicholasdille
nicholasdille / PSDSC-ResourceDownloader.ps1
Created January 5, 2015 21:09
Download Script for all #PSDSC Resources on TechNet
param(
[string]$ResourceUrlCacheFile = (Join-Path -Path $PSScriptRoot -ChildPath 'PSDSC-ResourceDownloader.clixml')
,
[switch]$IgnoreCachedUrls = $false
,
[switch]$OverwriteExistingModules = $false
)
if (-Not (Test-Path -Path $ResourceUrlCacheFile) -Or $IgnoreCachedUrls) {
$ModuleList = New-Object System.Collections.ArrayList