Skip to content

Instantly share code, notes, and snippets.

@signalwarrant
Created March 9, 2021 19:23
Show Gist options
  • Select an option

  • Save signalwarrant/5d69f6cfda2f5a6c27ac870d83c2e6a6 to your computer and use it in GitHub Desktop.

Select an option

Save signalwarrant/5d69f6cfda2f5a6c27ac870d83c2e6a6 to your computer and use it in GitHub Desktop.
ExchangeSVCmofPush.ps1
# Your Configuration
Configuration ExchangeService {
# Parameters
# Accepts a string value computername or defaults to localhost
Param([string[]]$ComputerName = "localhost")
# Target Node
Node $ComputerName {
# Service Resource
# Ensure a service is started
Service MSExchangeTransport {
Name = 'MSExchangeTransport'
State = 'Running'
}
}
}
# Generate the .MOF files
ExchangeService -ComputerName EXCH
# MOF files are created in whatever directory you're in in the PS Console
# 1 MOF file per target node
# Apply the configuration
Start-DscConfiguration -path ExchangeService -Wait -Verbose -Force
# View Deployed Configurations
Get-DscConfiguration -CimSession EXCH
#Testing Config (detect drift)
Test-DscConfiguration -CimSession EXCH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment