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; |
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'); | |
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; |
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: [email protected] | |
# 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; |
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 |
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'; | |
}; |
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"); } }; |
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 = '[email protected]'; | |
$AzureCredential = Get-Credential -UserName $Username -Message 'Please enter your password'; | |
Add-AzureAccount -Credential $AzureCredential; | |
$ModuleName = 'Azure'; | |
Import-Module -Name $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
$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; |
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 = '[email protected]'; | |
$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