Skip to content

Instantly share code, notes, and snippets.

Jeff Patton jeffpatton1971

Block or report user

Report or block jeffpatton1971

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jeffpatton1971
jeffpatton1971 / BasicWebServer.ps1
Last active Jan 1, 2016
Desired State Configuration for a basic web server
View BasicWebServer.ps1
Configuration BasicWebServer
{
param
(
[string]$ComputerName
)
Node $ComputerName
{
WindowsFeature WebServerRole
@jeffpatton1971
jeffpatton1971 / SetupDSCClient.ps1
Last active Jan 1, 2016
A simple DSC Client Setup Configuration
View SetupDSCClient.ps1
Configuration SetupDSCClient
{
param
(
[string]$NodeId,
[string]$PullServer
)
LocalConfigurationManager
{
@jeffpatton1971
jeffpatton1971 / AddDSCService.ps1
Created Dec 30, 2013
This adds the DCS-Service as a configuration
View AddDSCService.ps1
Configuration DSCPullServer
{
param
(
[string]$ComputerName
)
Node $ComputerName
{
WindowsFeature DSCService
View Setup-PullServer.ps1
$SourcePath = "$($pshome)\modules\psdesiredstateconfiguration\pullserver"
$DestinationPath = "C:\inetpub\wwwroot\PSDSCPullServer"
$AppPool = "DSCAppPool"
New-Item C:\inetpub\wwwroot\PSDSCPullServer\bin -ItemType directory -Force
Copy-Item "$($SourcePath)\psdscpullserver.*" $DestinationPath
Copy-Item "$($SourcePath)\Global.asax" $DestinationPath
Copy-Item "$($SourcePath)\Microsoft.Powershell.DesiredStateConfiguration.Service.dll" "$($DestinationPath)\bin"
Rename-Item "$($DestinationPath)\psdscpullserver.config" "$($DestinationPath)\web.config"
Copy-Item "$($SourcePath)\Devices.mdb" "$($env:programfiles)\WindowsPowerShell\DscService"
@jeffpatton1971
jeffpatton1971 / WebServer.ps1
Last active Apr 16, 2019
This DSC Configuration shows off several features available via DSC. It installs the Web-Server feature, and several additional web features that each depend on Web-Server being installed. It uses the Package reference to install the WebDeploy MSI, based on that path passed in the param, which also depends on Web-Server. It uses a Script referen…
View WebServer.ps1
Configuration BasicWebServer
{
param
(
[Parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
[string]$ComputerName,
[string]$Source = $null,
[Parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
@jeffpatton1971
jeffpatton1971 / Defaults2012R2.ps1
Created Dec 31, 2013
Windows Server 2012 R2 Default installed features
View Defaults2012R2.ps1
Configuration Defaults2012R2
{
param
(
[Parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
[string]$ComputerName
)
Node $ComputerName
{
@jeffpatton1971
jeffpatton1971 / New-DscFile.ps1
Last active Oct 12, 2016
Detect installed and not installed features to output a DSC file
View New-DscFile.ps1
<#
.SYNOPSIS
Detect installed and not installed features to output a DSC file
.DESCRIPTION
This script will return a list of features that are installed and not installed
for the server you run it on. This can be viewed as a basic starting point in
getting DSC up and running for a given server. Once you have this information
you can use it to simply make sure this server always has these settings, or
add to it with more DSC Resources.
.EXAMPLE
@jeffpatton1971
jeffpatton1971 / New-RulesFromNetstat.ps1
Created Jan 15, 2014
A script to create firewall rules based on netstat output
View New-RulesFromNetstat.ps1
<#
Create FW rules for TCP and UDP Listening Ports
netstat -an -p tcp |Select-String "Listening"
netstat -an -p udp |Select-String "Listening"
for each entry in netstat create firewall rule
name = -p tcp|udp port port #
description = automatic allow rule generated by powershell on get-date
View json.cs
public static T GetEdmundsContent<T>(string url) where T : new()
{
using (var client = new WebClient())
{
var jsonData = string.Empty;
try
{
Sleep(1000);
jsonData = client.DownloadString(url);
}
@jeffpatton1971
jeffpatton1971 / Copy-OuDelegation.ps1
Created Mar 25, 2014
Copy security between Ou's
View Copy-OuDelegation.ps1
<#
.SYNOPSIS
Template script
.DESCRIPTION
This script sets up the basic framework that I use for all my scripts.
.PARAMETER
.EXAMPLE
.NOTES
ScriptName : Copy-Delegations.ps1
Created By : jspatton
You can’t perform that action at this time.