Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am flickerfly on github.
  • I am josiah (https://keybase.io/josiah) on keybase.
  • I have a public key whose fingerprint is 7CB4 B7B7 E9FD 0CC9 F1C7 80EF B368 C6FB 4C9E F4AA

To claim this, I am signing this object:

@flickerfly
flickerfly / Get-ServiceByAccount.ps1
Last active December 14, 2015 19:28
Find a windows service by the account it runs as
$accounts = @("name1","name2")
ForEach ($account in $accounts)
{
Get-WmiObject Win32_Service | where {$_.StartName -like "*$account*"}
} #end foreach
@flickerfly
flickerfly / IterateComputers.ps1
Created March 11, 2013 20:37
Iterate over all domain member servers that aren't domain controllers
#Select Servers that are not Domain Controllers
$computers = Get-ADComputer -Filter { operatingsystem -like "*server*" -and Enabled -eq "True" }
Foreach($computer in $computers)
{
} #end foreach
@flickerfly
flickerfly / Get-CurrentDomainName
Last active December 15, 2015 09:39
Get the name of the domain I'm on
#Put the domain of the computer this script is running on into the $domain variable
$domain = [System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain().Name
@flickerfly
flickerfly / Get-DomainControllers.ps1
Last active December 15, 2015 10:29
Find all the Domain Controllers
$DomainControllers = [System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain().DomainControllers
@flickerfly
flickerfly / cleanCentOStemplate.sh
Created September 12, 2013 14:13
This is intended to clean up a CentOS or RedHat 6 box for conversion to a template in VMWare or other environments. It should be the last thing run before shutting down.
#!/bin/bash
# This is intended to clean up a CentOS or RedHat 6 box for
# conversion to a template in VMWare or other environments
# Free to use as a reference document, check before you use this
# as I can't take responsibility if it breaks something
# You may want to simply delete the config files,
# I prefer to just remove the MAC record
@flickerfly
flickerfly / user_mem_usage.sh
Created September 12, 2013 15:06
Get memory usage of a user
$user = apache
ps u -u $user | awk '{total+=$3}END{print total}'
@flickerfly
flickerfly / todays_yum_changes.sh
Created September 12, 2013 15:08
Record the yum changes from today in a file that can be used to cut and paste appended to the command 'sudo yum install'
sudo grep "`date "+%b %d"`" /var/log/yum.log | awk '{print $5}' | tr "\n$" ' ' > `date "+%d%b"`.yum
@flickerfly
flickerfly / amIroot.sh
Created September 12, 2013 20:08
A little check if a script is being run as root and exit if not with an error.
# Must be run with root permissions
# sudo will be sufficient
if [ "$(id -u)" != "0" ]; then
echo "This script must be run as root" 1>&2
exit 1
fi
@flickerfly
flickerfly / crashplan
Created October 28, 2013 18:52
CrashPlan ufw firewall profile
[CrashPlan]
title=CrashPlan
description=CrashPlan is a simple and yet powerful backup solution that does not require a central server for management.
ports=4242/tcp