Skip to content

Instantly share code, notes, and snippets.

View signalwarrant's full-sized avatar

David Hall signalwarrant

View GitHub Profile
# Get all Modules, Functions, Alias' ...etc available on your computer
Get-Command -all
# Search for all cmdlets that contain Service in the noun portion.
Get-command –noun Service
# Search for all cmdlets that contain Stop in the verb portion
Get-Command -Verb Stop
# You can also use the * character as a wildcard
# You must have Chocolately installed first
# Usage example
# Install-MySoftware -Computers dc1,dc2,svr12,svr16 -Packages 'powershell.portable','microsoft-edge','microsoft-windows-terminal'
Function Install-MySoftware {
[CmdletBinding()]
Param(
[Parameter()]
[string[]]$Computers,
# Install Chocolatey
Invoke-Command -ComputerName DC -ScriptBlock {
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
choco feature enable -y allowGlobalConfirmation
}
Function Get-Inventory {
<#
.SYNOPSIS
Gets a variety of computer information remotely and exports it to
a CSV file.
.PARAMETER Computers
Specifies the Computer names of devices to query
.INPUTS
@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.
@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 / 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 / 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 / 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 / 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