Skip to content

Instantly share code, notes, and snippets.

View signalwarrant's full-sized avatar

David Hall signalwarrant

View GitHub Profile
@signalwarrant
signalwarrant / DisableFirewallLCM.ps1
Created March 17, 2021 14:10
DisableFirewallLCM.ps1
[DSCLocalConfigurationManager()]
configuration LCMConfigNames
{
param
(
[Parameter(Mandatory= $true)]
[string[]]$ComputerName,
[Parameter(Mandatory= $true)]
[string]$regKey,
@signalwarrant
signalwarrant / DisableFirewallDSC.ps1
Created March 17, 2021 14:08
DisableFirewallDSC.ps1
configuration DisableFirewall {
param ()
Import-DscResource –ModuleName 'NetworkingDsc'
Node localhost
{
FirewallProfile DisableFirewall
{
Name = 'Domain'
Enabled = 'True'
@signalwarrant
signalwarrant / ExchangeSVCmofPush.ps1
Created March 9, 2021 19:23
ExchangeSVCmofPush.ps1
# Your Configuration
Configuration ExchangeService {
# Parameters
# Accepts a string value computername or defaults to localhost
Param([string[]]$ComputerName = "localhost")
# Target Node
Node $ComputerName {
# 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
# Run on the target node
Configuration LCMPullConfig
{
LocalConfigurationManager
{
ConfigurationID = "EXCH";
RefreshMode = "PULL";
DownloadManagerName = "WebDownloadManager";
RebootNodeIfNeeded = $true;
RefreshFrequencyMins = 30;
@signalwarrant
signalwarrant / ExchangeSVCmof.ps1
Created March 9, 2021 19:07
ExchangeSVCmof.ps1
# Your Configuration
Configuration ExchangeService {
# Parameters
# Accepts a string value computername or defaults to localhost
Param([string[]]$ComputerName = "localhost")
# Target Node
Node $ComputerName {
@signalwarrant
signalwarrant / CreatePullServer.ps1
Created March 9, 2021 19:04
CreatePullsServer.ps1
# Step 1 Install xPSDesiredStateConfiguration
Install-Module -Name xPSDesiredStateConfiguration
# Step 2
# Create the Pull Server.
Configuration CreatePullServer {
param (
[string[]]$ComputerName = 'localhost'
)
@signalwarrant
signalwarrant / DSCResources.ps1
Created March 9, 2021 19:00
DSCResources.ps1
# 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
@signalwarrant
signalwarrant / HashTables.ps1
Created March 9, 2021 18:46
HashTables.ps1
# 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,
@signalwarrant
signalwarrant / Sort-Select.ps1
Created March 9, 2021 18:42
Sort-Select.ps1
# 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