Note: I did not author this, i found it somehwere.
- Tools
- Most common paths to AD compromise
- [GPO - Pivoting with Local Admin
#!/bin/bash | |
<<ABOUT_THIS_SCRIPT | |
------------------------------------------------------------------------------- | |
Written by:William Smith | |
Professional Services Engineer | |
Jamf | |
[email protected] | |
https://gist.github.com/2cf20236e665fcd7ec41311d50c89c0e |
$GroupObject = Get-ADGroup 'MyGroupName' | |
$NTPrincipal = Get-ADUser 'myUserName' | |
if ($GroupObject -and $NTPrincipal) { | |
$acl = Get-Acl "AD:$($GroupObject.distinguishedName)" | |
$identity = [System.Security.Principal.IdentityReference] $NTPrincipal.SID | |
$adRights = [System.DirectoryServices.ActiveDirectoryRights]::WriteProperty -bor [System.DirectoryServices.ActiveDirectoryRights]::WriteDacl |
#Requires -RunAsAdministrator | |
<# | |
.SYNOPSIS | |
Creates a Self Signed Certificate for use in server to server authentication | |
.DESCRIPTION | |
.EXAMPLE | |
PS C:\> .\Create-SelfSignedCertificate.ps1 -CommonName "MyCert" -StartDate 2015-11-21 -EndDate 2017-11-21 | |
This will create a new self signed certificate with the common name "CN=MyCert". During creation you will be asked to provide a password to protect the private key. | |
.EXAMPLE | |
PS C:\> .\Create-SelfSignedCertificate.ps1 -CommonName "MyCert" -StartDate 2015-11-21 -EndDate 2017-11-21 -Password (ConvertTo-SecureString -String "MyPassword" -AsPlainText -Force) |
Note: I did not author this, i found it somehwere.
# Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser | |
# src: https://gist.github.com/apfelchips/62a71500a0f044477698da71634ab87b | |
# New-Item $(Split-Path "$($PROFILE.CurrentUserCurrentHost)") -ItemType Directory -ea 0; Invoke-WebRequest -Uri "https://git.io/JYZTu" -OutFile "$($PROFILE.CurrentUserCurrentHost)" | |
# ref: https://devblogs.microsoft.com/powershell/optimizing-your-profile/#measure-script | |
# ref: Powershell $? https://stackoverflow.com/a/55362991 | |
# ref: Write-* https://stackoverflow.com/a/38527767 | |
# Write-Host wrapper for Write-Information -InformationAction Continue |
# Your Configuration | |
Configuration ExchangeService { | |
# Parameters | |
# Accepts a string value computername or defaults to localhost | |
Param([string[]]$ComputerName = "localhost") | |
# Target Node | |
Node $ComputerName { |
# Step 1 Install xPSDesiredStateConfiguration | |
Install-Module -Name xPSDesiredStateConfiguration | |
# Step 2 | |
# Create the Pull Server. | |
Configuration CreatePullServer { | |
param ( | |
[string[]]$ComputerName = 'localhost' | |
) |
# 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 |
# 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, |