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
[DSCLocalConfigurationManager()] | |
configuration LCMConfigNames | |
{ | |
param | |
( | |
[Parameter(Mandatory= $true)] | |
[string[]]$ComputerName, | |
[Parameter(Mandatory= $true)] | |
[string]$regKey, |
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 DisableFirewall { | |
param () | |
Import-DscResource –ModuleName 'NetworkingDsc' | |
Node localhost | |
{ | |
FirewallProfile DisableFirewall | |
{ | |
Name = 'Domain' | |
Enabled = 'True' |
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
# Your Configuration | |
Configuration ExchangeService { | |
# Parameters | |
# Accepts a string value computername or defaults to localhost | |
Param([string[]]$ComputerName = "localhost") | |
# Target Node | |
Node $ComputerName { |
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
# Get all the DSC CMDLets | |
Get-Command -Noun dsc* | |
# Get Available Resources | |
# Refer to powershellgallery.com for additional resources | |
Get-DscResource | |
# What can we configure for each resource | |
Get-DscResource File | Select -ExpandProperty Properties |
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
# Run on the target node | |
Configuration LCMPullConfig | |
{ | |
LocalConfigurationManager | |
{ | |
ConfigurationID = "EXCH"; | |
RefreshMode = "PULL"; | |
DownloadManagerName = "WebDownloadManager"; | |
RebootNodeIfNeeded = $true; | |
RefreshFrequencyMins = 30; |
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
# Your Configuration | |
Configuration ExchangeService { | |
# Parameters | |
# Accepts a string value computername or defaults to localhost | |
Param([string[]]$ComputerName = "localhost") | |
# Target Node | |
Node $ComputerName { |
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
# Step 1 Install xPSDesiredStateConfiguration | |
Install-Module -Name xPSDesiredStateConfiguration | |
# Step 2 | |
# Create the Pull Server. | |
Configuration CreatePullServer { | |
param ( | |
[string[]]$ComputerName = 'localhost' | |
) |
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
# NoGo | |
Get-Command -Module xPSDesiredStateConfiguration | |
# NoGo | |
xService | Get-Member | |
# Shows all DSC Resources currently installed in PS ModulePath | |
# Access PSModulepath | |
# cd env: | |
# dir | Where-Object Name -eq PSModulePath |
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
# Example No Hash table or Calculated Properties | |
Get-WmiObject -Class WIN32_volume -ComputerName localhost -Filter 'drivetype = 3' | | |
Select-Object -Property PScomputerName, | |
DriveLetter, | |
Label, | |
FreeSpace | |
# Example using a Hash table | |
Get-WmiObject -Class WIN32_volume -ComputerName localhost -Filter 'drivetype = 3' | | |
Select-Object -Property PScomputerName, |
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
# Selecting | |
#Default | |
Get-Process | |
# All Properties | |
Get-Process | Select-Object -Property * | Out-GridView | |
# Sorting | |
# Changes the default sorting order for Get-Process | |
Get-Process | Sort-Object CPU |
NewerOlder