View gist:a52069044f2940c792eb
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
Install-Module -Name IseHg -Scope CurrentUser; |
View gist:3ea6936bb58956f9452e
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
# Create a new object | |
$Person = [PSCustomObject]@{ | |
FirstName = 'Nickolaj'; | |
LastName = 'Andersen'; | |
Age = 27 | |
}; | |
# Add a custom "type" name to the object called "Person" | |
$Person.pstypenames.Add('Person'); | |
View Import-IseHg.ps1
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
Import-Module -Name IseHg; |
View gist:d7c501fad6bd0f7333ae
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
# Author: Trevor Sullivan | |
# E-mail: pcgeek86@gmail.com | |
# Website: http://trevorsullivan.net | |
# Description: This script allows you to quickly review the contents of a list of files | |
# in the folder specified in the $Path variable, using the "more" function. | |
$Path = 'C:\Users\ts\Documents\WindowsPowerShell\Modules\DSC\Resources'; | |
$FileList = Get-ChildItem -Path $Path -Recurse | ? { !$_.PSIsContainer; }; | |
$FileList | % { | |
Clear-Host; |
View gist:b5f29ab8a11b414b230f
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
$MyFilter = New-WmiEventFilter –Name WatchFolderRoboCopy –Query 'SELECT * FROM __InstanceCreationEvent WITHIN 10 WHERE TargetInstance ISA "CIM_DirectoryContainsFile" AND TargetInstance.GroupComponent = "Win32_Directory.Name=\"c:\\\\FileHistory\""' –EventNamespace "root\cimv2" | |
$MyConsumer = New-WmiEventConsumer –ConsumerType CommandLine –Name WatchFolderRoboCopy –CommandLineTemplate "c:\\windows\\system32\\windowspowershell\\v1.0\\powershell.exe -ExecutionPolicy Bypass -<<<ParameterName1>>> %TargetInstance.<<<WmiPropertyName>>>%" | |
New-WmiFilterToConsumerBinding –Filter $MyFilter –Consumer $MyConsumer |
View DSC-NewAzureVM.ps1
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
#region Subscription | |
$SubscriptionName = 'Visual Studio Ultimate with MSDN'; | |
Select-AzureSubscription -SubscriptionName $SubscriptionName; | |
#endregion | |
#region Affinity Group | |
$AffinityGroup = @{ | |
Name = 'powershelldsc'; | |
Location = 'North Central US'; | |
}; |
View DSC-DSCWave.ps1
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 DSCWave { | |
Archive DSCWave { | |
DependsOn = '[Script]DSCWave'; | |
Ensure = 'Present'; | |
Path = "$env:windir\temp\DSC Resource Kit Wave 6 08212014.zip"; | |
Destination = "$env:ProgramFiles\WindowsPowerShell\Modules"; | |
} | |
Script DSCWave { | |
GetScript = { @{ Result = (Test-Path -Path "$env:windir\temp\DSC Resource Kit Wave 6 08212014.zip"); } }; |
View PPE2014Oct - Create Azure VM
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
Add-AzureAccount; | |
$Username = 'azureps@trevorsullivan.net'; | |
$AzureCredential = Get-Credential -UserName $Username -Message 'Please enter your password'; | |
Add-AzureAccount -Credential $AzureCredential; | |
$ModuleName = 'Azure'; | |
Import-Module -Name $ModuleName; |
View Get-ParameterList.ps1
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
$ParameterList = @(); | |
# Get a list of PowerShell commands | |
$CommandList = Get-Command -CommandType Cmdlet,Function -Module Azure; | |
foreach ($Command in $CommandList) { | |
foreach ($ParameterSet in $Command.ParameterSets) { | |
foreach ($Parameter in $ParameterSet.Parameters) { | |
$ParameterList += [PSCustomObject]@{ | |
Module = $Command.ModuleName; |
View Create Azure Virtual Network High Performance Gateway.ps1
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
# Authenticate to Microsoft Azure and import subscription details | |
$Username = 'trevor@trevorsullivan.net'; | |
$GetCredential = @{ | |
Username = $Username; | |
Message = 'Please enter your Microsoft Azure password.'; | |
} | |
$AzureCredential = Get-Credential @GetCredential; | |
Add-AzureAccount -Credential $AzureCredential; | |
# Select the appropriate Microsoft Azure subscription |
OlderNewer