Skip to content

Instantly share code, notes, and snippets.

View signalwarrant's full-sized avatar

David Hall signalwarrant

View GitHub Profile
@signalwarrant
signalwarrant / gMSA.ps1
Last active October 4, 2021 18:09
Group Managed Service Accounts
<#
Step 1 - (on a non-DC)
Add-WindowsFeature RSAT-AD-PowerShell
Step 2 - Create a Security group and add all the hostnames you will use the gMSA on.
These are the computers permitted to retrieve the password from AD
#>
$gMSA_Name = 'svc_sql'
$gMSA_FQDN = 'svc_sql.hall.test'
@signalwarrant
signalwarrant / myLab.ps1
Last active October 4, 2021 18:09
AutomatedLab Example
$labName = 'TestLab'
$domain = 'test.lab'
$adminAcct = 'Administrator'
$adminPass = 'YourPasswordHere'
$labsources = "D:\LabSources"
#Create an empty lab template and define where the lab XML files and the VMs will be stored
New-LabDefinition -Name $labName -DefaultVirtualizationEngine HyperV
#Network definition
@signalwarrant
signalwarrant / DSC-SelfSignedCert.ps1
Last active October 4, 2021 18:09
Advanced Auditing DSC
# Code Source: http://duffney.io/Configure-HTTPS-DSC-PullServerPSv5
$inf = @"
[Version]
Signature="`$Windows NT`$"
[NewRequest]
Subject = "CN=DC, OU=IT, O=Signalwarrant, L=Augusta, S=SE, C=US"
KeySpec = 1
KeyLength = 2048
Exportable = TRUE
@signalwarrant
signalwarrant / DSCPullServerConfig.ps1
Created August 9, 2019 20:00
Advanced Auditing Pull Server Config
# 4. Configure the Pull Server
Configuration DscPullServer
{
param
(
[string[]]$NodeName = 'localhost',
[ValidateNotNullOrEmpty()]
[string] $certificateThumbPrint,
@signalwarrant
signalwarrant / DSCMOFConfig.ps1
Created August 9, 2019 20:05
Advanced Auditing MOF Config
# 5. Create the client MOFs
# https://github.com/PowerShell/AuditPolicyDsc
Configuration AuditPolicyCsv {
param(
[String] $NodeName = 'SVR'
)
Import-DscResource -ModuleName AuditPolicyDsc
@signalwarrant
signalwarrant / DSCLCMConfig.ps1
Created August 9, 2019 20:08
Advanced Auditing LCM Config
# Run on the target node
[DSCLocalConfigurationManager()]
Configuration LCMConfig {
Node SVR {
Settings {
ConfigurationMode = 'ApplyAndAutoCorrect'
RefreshMode = 'Pull'
}
ConfigurationRepositoryWeb PullServer {
@signalwarrant
signalwarrant / Convert-ToPDF.ps1
Created August 9, 2019 20:17
Convert text files to PDF
Function ConvertTo-PDF {
<#
.DESCRIPTION
Convert 1 or many files to PDFs
.PARAMETER filePath
-filePath: The path to the folder that contains all your text files
.PARAMETER dllPath
-dllPath: The Path to the iTextSharp.DLL file
@signalwarrant
signalwarrant / new-ADDomain.json
Created September 3, 2019 23:32
new-ADDomain ARM Template
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"adminUsername": {
"type": "string",
"metadata": {
"description": "The name of the administrator account of the new VM and domain"
}
},
@signalwarrant
signalwarrant / Format-MerchReports.ps1
Created September 5, 2019 20:28
Format-MerchReports.ps1
Function Format-MerchReports {
<#
.SYNOPSIS
Reformats and combines Merch by Amazon sales reports
.DESCRIPTION
1. Deletes the first 13 rows of each CSV in $csvPath
2. Combines the data from all the files
3. Adds column headers defined in $finalHeader
4. Outputs the file to $csvPath as formatted-Merchreports.csv
@signalwarrant
signalwarrant / Get-LocalAdmins.ps1
Created September 5, 2019 20:30
Get-LocalAdmins
Function Get-LocalAdmins {
<#
.SYNOPSIS
Gets the members of the local administrators of the computer
and outputs the result to a CSV file.
.PARAMETER Computers
Specifies the Computer names of devices to query
.INPUTS
System.String. Get-LocalAdmins can accept a string value to
determine the Computers parameter.