View BasicWebServer.ps1
Configuration BasicWebServer | |
{ | |
param | |
( | |
[string]$ComputerName | |
) | |
Node $ComputerName | |
{ | |
WindowsFeature WebServerRole |
View SetupDSCClient.ps1
Configuration SetupDSCClient | |
{ | |
param | |
( | |
[string]$NodeId, | |
[string]$PullServer | |
) | |
LocalConfigurationManager | |
{ |
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" |
View WebServer.ps1
Configuration BasicWebServer | |
{ | |
param | |
( | |
[Parameter(Mandatory=$true)] | |
[ValidateNotNullOrEmpty()] | |
[string]$ComputerName, | |
[string]$Source = $null, | |
[Parameter(Mandatory=$true)] | |
[ValidateNotNullOrEmpty()] |
View Defaults2012R2.ps1
Configuration Defaults2012R2 | |
{ | |
param | |
( | |
[Parameter(Mandatory=$true)] | |
[ValidateNotNullOrEmpty()] | |
[string]$ComputerName | |
) | |
Node $ComputerName | |
{ |
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 |
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); | |
} |
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 |
OlderNewer