Skip to content

Instantly share code, notes, and snippets.

Robert Townley rjt

View GitHub Profile
@rjt
rjt / RecycleBin.ps1
Created Oct 23, 2017 — forked from lazywinadmin/RecycleBin.ps1
RecycleBin PowerShell script
View RecycleBin.ps1
<#
This script creates object which correctly works with ntfs streams and reparse points
Usage samples:
'.\*.bak' | recycle -WipeOut -> multiplies objects by zero
recycle -Path '.\*.ini' -> sends objects to Recycle Bin
$RecycleBin.Measure() -> returns true size of all items in Recycle Bin
$RecycleBin.Clear() -> this is obvious
$RecycleBin.List() -> returns friendly items list
@rjt
rjt / modinfo-ip_set
Last active Aug 29, 2015
ip_set module not loading into CentOS 6.5
View modinfo-ip_set
[root]# modinfo ip_set
filename: /lib/modules/2.6.32-431.23.3.el6.x86_64/kernel/net/netfilter/ipset/ip_set.ko
alias: nfnetlink-subsys-6
description: core IP set support
author: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
license: GPL
srcversion: 3EDD1B73D424DDE6D909F01
depends: nfnetlink
vermagic: 2.6.32-431.23.3.el6.x86_64 SMP mod_unload modversions
parm: max_sets:maximal number of sets (int)
@rjt
rjt / Powershell-string-problem-ShorterTranscript
Created Jul 25, 2014
Shorter version, somehow PowerShell 4 on Win2012R2 fully updated is treating my strings as expressions. Any idea on how to fix?
View Powershell-string-problem-ShorterTranscript
**********************
Windows PowerShell transcript start
Start time: 20140724200011
Username : DOMAIN\Robert
Machine : DOMAIN01 (Microsoft Windows NT 6.3.9600.0)
**********************
Transcript started, output file is P:\docs\robert\source\ps\ReadXML-DHCP-GIST.ps1.log
PS P:\docs\robert\SOURCE\ps>
PS P:\docs\robert\SOURCE\ps> .\ReadXML-DHCP-GIST.ps1
View PowerShell-Transcript.txt
**********************
Windows PowerShell transcript start
Start time: 20140724193635
Username : eceo\admRobert
Machine : DOMAIN01 (Microsoft Windows NT 6.3.9600.0)
**********************
Transcript started, output file is C:\Users\admrobert.eceo\Documents\PowerShell_transcript.20140724193635.txt
PS P:\docs\robert\SOURCE\ps> .\ReadXML-DHCP.ps1
Security warning
View WayTooMuch.ps1
$ReservationsFile = "P:\DOCS\TECH\DataComm Infrastructure\DHCP-NetMan-20140721000436-NewLayout.XML"
[xml] $xml = Get-Content $ReservationsFile
$Reservations = $xml.DHCPServer.IPV4.Scopes.Scope.Reservations.Reservation;
#/DHCPServer/IPv4/Scopes/Scope/Reservations/Reservation"
foreach ($Reservation in $Reservations)
{
if("YES" -eq $Reservation.UpdateServer)
{
$dhcpEntry =
@{
View Strings
#Unexpected token '3c-0c' in expression or statement.
#You must provide a value expression following the '-' operator.
[string]$Mac3='00-16-d4-08-3c-0c';
$Mac3.GetType() #returns string.
$dhcpEntry.Item("ClientId")
#Get-DhcpS does not find the entry some of the time. If i put in the number directly, it will work.
Get-DhcpServerv4Reservation -ClientId $Mac3 -ScodeID 10.0.100.0
You can’t perform that action at this time.