This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$accumulatedList ='' | |
foreach ($ws in dsquery computer -limit 1000 -name "*COMMON-NAME-FRAGMENT*" | dsget computer -samid | %{$_ -replace "\$",""}) { | |
$candidatehost = $ws.trim() | |
ping -n 2 $candidatehost | |
if ($LASTEXITCODE -eq 0) { | |
echo "##==-- TARGET UNIT ACTIVE! --------- $candidatehost --==##`a" | |
## this line only works on TServers ## query session /server:$candidatehost | |
try { | |
$userProc = gwmi win32_process -computer $candidatehost -filter "Name = 'explorer.exe'" -ErrorAction "Stop" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Get-ChildItem -Force | Where-Object { $_.PSIsContainer } | ForEach-Object { $_.Name + ": " + "{0:N2}" -f ((Get-ChildItem $_ -Recurse | Measure-Object Length -Sum -ErrorAction SilentlyContinue).Sum / 1MB) + " MB" } | % { if ($_ -notmatch ': [0-9]{1,2}\.') {$_;} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Standard informational header first. | |
## | |
## Configuration section next | |
$maxfoo = 10; | |
## | |
Start-Transcript -Path ".\$(([io.fileinfo]$MyInvocation.MyCommand.Definition).basename.Trim())_exec.log" | |
###### OR # "$($env:TEMP)\$(([io.fileinfo]$MyInvocation.MyCommand.Definition).basename.Trim())_exec.log" | |
###### OR # "$($env:LOGS)\$(([io.fileinfo]$MyInvocation.MyCommand.Definition).basename.Trim())_exec.log" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#speech | |
$vox = New-Object -com SAPI.spvoice | |
$vox.speak("Testing testing 1 2 3") | |
#id knowledge | |
$vox.speak("Hello and welcome, $($env:username.substring(0,1)) $($env:username.substring(1))") | |
#time knowledge | |
$daysegments = @("Night","Morning","Morning","Afternoon","Evening","Night") | |
$curseg = [math]::Floor(((get-date -Uformat "%H") -5) / 4) + 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!Powershell | |
#Attempt to detect method of hashing/encrypting, focusing on the out-of-the-box .NET offerings | |
$messages = ('Create Enemy/Small Standard', | |
'create enemy/small standard', | |
'CREATE ENEMY/SMALL STANDARD', | |
'CreateEnemy/SmallStandard', | |
'Create Enemy/Small Standard ' ) #padded to 100 chars | |
$secret_keys = ('Artemis','artemis''ARTEMIS','2.4.0','eochu','EOCHU','techbear') | |
$hmac_classes = ('HMACMD5','HMACRIPEMD160','HMACSHA1','HMACSHA256','HMACSHA384','HMACSHA512') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias passphrasing="cat /usr/share/dict/words | random 10000 | grep '^[^A-Z]\{,8\}$' | sed \"s/'s$//\" | shuf -n 6 --random-source=/dev/random | xargs echo | sed 's/[^$]/\n/' | tee >( espeak --ipa ) >( sed '/^\s*$/d' | figlet -t -f tengwar ) | cat " |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--Row generator query to give us a rougly n MB output to CSV, as specified in the first term of the connect by clause | |
--thanks to excellent inspiration and resource from Natalka Roshak, https://blogs.oracle.com/sql/entry/row_generators_part_2 | |
select level, rownum,'zero_one_two_three_four_five_six_seven_eight_nine_ten_eleven_twelve_thirteen_fourteen_fifteen' number_names ,1234567890 ten_digit_number --about 115 bytes per row once csv'd | |
from dual | |
connect by level <= ( 80 * (1048576 / 112)) | |
; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Extremely low quality quick and dirty simulation of "dynamic data" feeding the mycroft httProjection. | |
# It does underscore how simple and easy and yet still pretty flexible this is, though. | |
pgrep -f 'python.*SimpleHTTPServer' || echo -e "the first thing you will want to do is start up the http service process with this command:\n\t python -m SimpleHTTPServer 8000 " | |
COUNTER=2 | |
DORMANCY=2 | |
until [ $COUNTER -lt 1 ]; do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!PowerShell | |
# Simple, basic localmachine MSSQL DB backup with no outage. | |
Start-Transcript -Path .\backup\MSSQL_Backup.log | |
get-date | |
write-output $env:COMPUTERNAME | |
Get-SqlDatabase -ServerInstance localhost | | |
Where { $_.Name -ne 'tempdb' } | | |
Backup-SqlDatabase -Verbose -BackupContainer .\backup\db\ |
OlderNewer