Skip to content

Instantly share code, notes, and snippets.

View Jackbennett's full-sized avatar

Jack Jackbennett

View GitHub Profile
@Jackbennett
Jackbennett / stylish.css
Created September 16, 2016 12:12
16:9 is narrow enough why use more of it? Moves github header to the top right. Mouseover to see the search.
/**
Moves github header to the top right. mouseover to see the search.
1. Install the Stylish(https://chrome.google.com/webstore/detail/stylish/fjnbnpbmkenffdnngjfgmeleoegfcffe?hl=en) extension for Chrome.
2. Open up extension options and paste the whole CSS mentioned below.
3. Specify the domain name to be `github.com`.
4. Add a title and save.
*/
.header[role="banner"] {
@Jackbennett
Jackbennett / datetime.ps1
Created February 7, 2017 09:34
Convert datetime error
$ get-date -OutVariable sd "6/2/2017 03:58"
06 February 2017 03:58:00
$ $sd | gm
TypeName: System.DateTime
Name MemberType Definition
@Jackbennett
Jackbennett / Remove.ps1
Last active February 7, 2017 10:55 — forked from anonymous/Remove.ps1
#Remove-MailQueueObjects.ps1
Param(
$Path = "D:\tst",
$pattern = "TextString",
$filter = "*.eml"
}
Get-ChildItem -Recurse -Path $Path -File -Filter $filter |
where {
get-content $psitem.fullname -ReadCount 0 |
@Jackbennett
Jackbennett / example_error.ps1
Created May 24, 2017 11:58
A waste of 10 minutes. Know what you're doing with try/catch
# By adding a credential parameter to my function I broke it and couldn't spot the fault for 10 mintues
# Rookie Mistake. Beware poor try/catch use.
try {
# Grab the events from a remote computer
$EventLog = Get-WinEvent -ComputerName $ComputerName -FilterHashtable -Credential:$Credential @{
Logname = 'Security';
Id = 4624;
StartTime = $StartDay.toShortDateString();
EndTime = $StopDay.toShortDateString();
} -ErrorAction Stop
@Jackbennett
Jackbennett / start-layout.xml
Created June 5, 2017 14:05
Missing pinned link/icons but working task bar
<LayoutModificationTemplate
xmlns="http://schemas.microsoft.com/Start/2014/LayoutModification"
xmlns:defaultlayout="http://schemas.microsoft.com/Start/2014/FullDefaultLayout"
xmlns:start="http://schemas.microsoft.com/Start/2014/StartLayout"
xmlns:taskbar="http://schemas.microsoft.com/Start/2014/TaskbarLayout"
Version="1">
<LayoutOptions StartTileGroupCellWidth="6" />
<DefaultLayoutOverride LayoutCustomizationRestrictionType="OnlySpecifiedGroups">
<StartLayoutCollection>
<defaultlayout:StartLayout GroupCellWidth="6" xmlns:defaultlayout="http://schemas.microsoft.com/Start/2014/FullDefaultLayout">
$EndTime = Get-WinEvent -ComputerName $ComputerName -FilterHashTable @{LogName = "Microsoft-Windows-AppLocker/EXE and DLL"; ID = 8001} -MaxEvents 1
Get-WinEvent -ComputerName $ComputerName -FilterHashTable @{LogName = "Microsoft-Windows-AppLocker/EXE and DLL"; EndTime = $EndTime.TimeCreated}
write-warning $EndTime.timecreated()
$ 1..1000 | %{ measure-command { ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")} }| sort -Descending -Property TotalMilliseconds | select -First 20 -Property TotalMilliseconds
TotalMilliseconds
-----------------
9.2754
0.9975
0.195
0.191
0.1877
0.1817
@Jackbennett
Jackbennett / scan AD computers.ps1
Created September 26, 2017 13:20 — forked from anonymous/scan AD computers.ps1
Improve the run performance of this script.
# Get All PCs in Domain, Export to ServerList.txt
# Call get-inventory.ps1 logic on created Serverlist.txt
# dk / 22.09.2017
import-module activedirectory
$domain = "carpentier.local"
$tempfile = "c:\temp\tmpfile.csv"
$outfile = "c:\temp\Serverlist.csv"
Get-ADComputer -Filter * |
select-object Name |
@Jackbennett
Jackbennett / Chrome Custom Searches.md
Created November 3, 2017 20:32
List of custom searches used in chrome
@Jackbennett
Jackbennett / debug osquery + fleet
Last active April 16, 2018 22:03
debugging TLS issue with osquery
osquery.flags ->
--enroll_secret_path=c:\programdata\osquery\heroku.secret
--tls_server_certs=c:\programdata\osquery\demoapponherokuapp.com.pem
--tls_hostname=demoapponherokuapp.com
--host_identifier=hostname
--enroll_tls_endpoint=/api/v1/osquery/enroll
--config_plugin=tls
--config_tls_endpoint=/api/v1/osquery/config
--config_tls_refresh=10
--disable_distributed=false