Skip to content

Instantly share code, notes, and snippets.

View cyberautomate's full-sized avatar

cyberautomate

View GitHub Profile
# 5. Create the client MOFs
# https://github.com/PowerShell/AuditPolicyDsc
Configuration AuditPolicyCsv {
param (
[String] $NodeName = 'SVR'
)
Import-DscResource -ModuleName AuditPolicyDsc
Node $NodeName {
# 4. Configure the Pull Server
Configuration DscPullServer {
param (
[string[]]$NodeName = 'localhost',
[ValidateNotNullOrEmpty()]
[string] $certificateThumbPrint,
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
# 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
FriendlyName = PSDSCPullServerCert
# Selecting
#Default
Get-Process
# All Properties
Get-Process | Select-Object -Property * | Out-GridView
# Sorting
# Changes the default sorting order for Get-Process
Get-Process | Sort-Object CPU
# Example No Hash table or Calculated Properties
Get-WmiObject -Class WIN32_volume -ComputerName localhost -Filter 'drivetype = 3' |
Select-Object -Property PScomputerName,
DriveLetter,
Label,
FreeSpace
# Example using a Hash table
Get-WmiObject -Class WIN32_volume -ComputerName localhost -Filter 'drivetype = 3' |
Select-Object -Property PScomputerName,
# NoGo
Get-Command -Module xPSDesiredStateConfiguration
# NoGo
xService | Get-Member
# Shows all DSC Resources currently installed in PS ModulePath
# Access PSModulepath
# cd env:
# dir | Where-Object Name -eq PSModulePath
<#
DESCRIPTION
1. Search an OU for computer accounts that have not authenticated in x number of days ($days)
2. Disable those accounts
3. Move those disabled computer accounts to another OU ($disabledOU)
4. Also creates a logfile of all the computers that were disabled ($logpath)
#>
####### Edit these Variables
# Gets todays Date
<#
PARAMETER ComputerName
See the examples below, the computername can be one or
many computer names
EXAMPLE
.\force-WSUScheckin.ps1 -ComputerName CL1
.\force-WSUScheckin.ps1 -ComputerName CL1 -verbose
.\force-WSUScheckin.ps1 -ComputerName CL1, CL2 -verbose
.\force-WSUScheckin.ps1 -ComputerName (Get-Content -Path "C:\computers.txt") -verbose
<#
PARAMETER ComputerName
See the examples below, the computername can be one or
many computer names
EXAMPLE
.\force-WSUScheckin.ps1 -ComputerName CL1
.\force-WSUScheckin.ps1 -ComputerName CL1 -verbose
.\force-WSUScheckin.ps1 -ComputerName CL1, CL2 -verbose
.\force-WSUScheckin.ps1 -ComputerName (Get-Content -Path "C:\computers.txt") -verbose
# 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