Call me...




Friday, May 13, 2022

Lansweeper email attachment filters (RegEx)

 Just getting into using Lansweeper's Helpdesk feature...
Working on trimming down what attachments to allow on incoming support emails -

Setting this up is done with RegEx...
Of course, there are no examples inside of the Lansweeper KB, for any of this, and RegEx are non-intuitive, cryptic, and just generally a pain, unless you use it ALL the time.

I don't see any way to ask Lansweeper to add additional content to their KB about this, so I'm putting it here... Plus a way to pop out the correctly formatted RegEx, using PoSh.

On this page: https://<YourLanSweeperURL>/configuration/HelpdeskEmail/

Go to: 'Ignored attachment filters (regular expressions)'

You can test the filter, on that same line of that page, too.

$Start = "^(.(?!.*\.("
$Middle = "jpg|png|bmp|pdf|txt"
$End = ")))*$"

$RegEx_Line = "$Start"+"$Middle"+"$End"
$RegEx_Line

<#
# Result
^(.(?!.*\.(jpg|png|bmp|pdf|txt)))*$

# Ignored attachment filters (regular expressions)
# On this page: https://<YourLanSweeperURL>/configuration/HelpdeskEmail/

"All attachments in E-mails which match one of these regular expressions will not be saved to the web server."

It is an inverted argument - so that anything that 'matches' gets blocked...
Examples:
Filename.jpg - No Match! (Allowed)
Filename.png - No Match! (Allowed)
Filename.bmp - No Match! (Allowed)
Filename.pdf - No Match! (Allowed)
Filename.txt - No Match! (Allowed)

Filename.exe - Match found! (Blocked)
Filename.msi - Match found! (Blocked)
Filename.mp4 - Match found! (Blocked)
Filename.xx2 - Match found! (Blocked)
#>

Tuesday, May 10, 2022

netsh advfirewall set allprofiles state off

netsh advfirewall set allprofiles state off

Also:

c:\windows\system32\winrm.cmd quickconfig -quiet

Just putting this out there for easy copy / pasta

Others...

netsh advfirewall set currentprofile state off

netsh advfirewall set domainprofile state off

netsh advfirewall set privateprofile state off

netsh advfirewall set publicprofile state off

All this time, I was convinced that I wasn't able to reach newly joined (to the domain), because of DNS replication issues...
Finally decided to look into this, and it eventually occurred to me to look at the firewall, that is enabled by default...
smdh!

Monday, March 7, 2022

The Book of Job

Don't take the story of Job so literally - It's not like there was a journalist there writing everything down...

Stripped down to its core... The story is a lesson - It tells the student to not have a shitty attitude - because doing so just generates misery.

Otherwise stated... What consumes your thoughts, controls your life.

It is probably one of my favorite stories ever.

The story / lesson it is passing along is some very powerful advice that anyone can benefit from. Hence its tenacity.

Just because religiofucktards call it theirs is no reason to disavow its intent.

It is at least 8000 years old (probably out-dating King Hammurabis' code) and was (as most stories were) passed by word of mouth up until about 1700 years ago. The original story was not likely to have been centered around supernatural mono-theistic entities... Whereas, mono-theisim is about 5000-3000 years old.

The Jewish faith managed to hijack much of Sumerian mythology along with that cultures oral histories and parables... Including the story of 'Job'... And still Hebrews insist 'collectively' to call it all 'Jewish' / ''Torah' - Talk about plagiarism!!!

Removing all of the Judaeo-Christian bullshit and referring to the symbolisms as they were called out in antiquity - This is the lesson:

Don't cop an attitude! Be able and willing to let go of life's adversities and stresses... Because clinging to them, and / or worrying to much is just not healthy.

AKA:
Curse god, curse yourself = A bad attitude only hurts yourself.

WHEN YOU SEE IT, YOU WILL SHIT BRICKS

I composed a similar concept regarding Noah and the Ark here:
http://rich-laduca.blogspot.com/2013/01/while-global-flood-noah-and-ark-are.html

Wednesday, March 2, 2022

BeeLink Tools

A do all Powershell version is at the bottom here - Or...
Grab the tool here:
https://drive.google.com/file/d/1wmXwT6erye3U-l6YxwK5XUMa06CDregy/view?usp=sharing

Unzip it... (not shady looking at all, is it - Who you gonna trust? This post is mostly for me anyway)

I got this from BeeLink computers support thru Amazon...
I had to contact them, because the last several computers I've gotten had a generic "123456789" as the serial number in the BIOS.
But, for auditing purposes (on domain computers), I need to be able to programmatically see the serial number

If you run 'WriteOENSN.cmd', you can correct / update the serial number in BIOS.

I manually typed in the serial number from the sticker on the bottom of the computer, BUT -
The tool / process actually prompts to 'scan' it in (from the barcode on that same sticker).
So - If you have a USB barcode scanner you can plug into the computer... 

Scan it in... Way faster than typing!

These commands will show the serial number:

WMIC BIOS GET SERIALNUMBER

get-ciminstance win32_bios | select SerialNumber


Or - Grab this PoSh and it will do most of the work for you:

$Share_URL = "https://drive.google.com/file/d/1wmXwT6erye3U-l6YxwK5XUMa06CDregy/view?usp=sharing"

$Share_URL = "https://drive.google.com/uc?export=download&id=$($Share_URL.Split('/')[-2])"

$ZipDownload = "C:\Users\Public\Downloads\BeelinkTools.zip"
$ToolFolder = "$(Split-Path -Path $ZipDownload)\Beelink Tools"

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

(New-Object System.Net.WebClient).DownloadFile($Share_URL, $ZipDownload)

Expand-Archive -LiteralPath $ZipDownload -DestinationPath $ToolFolder

cd $ToolFolder
Start-Process -FilePath "C:\Windows\System32\cmd.exe" -Verb runas -ArgumentList {/k WriteOENSN.cmd}

Monday, February 21, 2022

Domain Controller Sync partner, force sync and show results

I ran into some annoyances related to it taking more time than my patience was allowing, for all of our domain controllers to be in sync... 

Because, while I am connected to a DC in the mid-West, making changes, it can take up to 15 minutes for those changes to be reflected with the DC's on the East coast... 






Adding in an Azure DC, and o365 to that, just shortens my patience even more, when I need to move things along...

Plus, if I suspect there may be sync issues, I needed a quick way to know / rule that out.

This script does a line by line replication with each respective DC sync partner - And reports that result.

Then it confirms the partner sync status.

I set the confirmation bit as a function, so that it can also easily be run by itself.

$SyncMeta = @()
Write-Host "Gathering DC sync partner list..." -Fore 14
$All_DCs_Sync = (Get-ADDomainController -Filter * | sort).Hostname | % {($_).Split('.')[0]} | % {
$Server_ = $_
$SyncMeta += Get-ADReplicationPartnerMetadata -Target $Server_ | select @{n='Server';e={$Server_}}, @{n='Partner';e={($_.Partner).Split(',')[1].Split('=')[1]}}
}
$DomPart = (Get-ADDomainController).DefaultPartition
$SyncMeta | % {
$SyncResult = Repadmin /replicate $_.Partner $_.Server $DomPart
Write-Host "  $(($SyncResult | Out-String).Trim())" -Fore 11
}

##################################

Function SyncReport {
''
Write-Host "Start sync query : " -Fore 14 -No
Get-Date -Format "MM/d/yyyy hh:mm:ss tt"

$All_DCs_Sync = (Get-ADDomainController -Filter * | sort).Hostname | % {($_).Split('.')[0]} | % {
$Server_ = $_
Get-ADReplicationPartnerMetadata -Target $Server_ | select @{n='Server';e={$Server_}}, @{n='Partner';e={($_.Partner).Split(',')[1].Split('=')[1]}}, LastReplicationAttempt, LastReplicationSuccess
}
Write-Host "Finish sync query: " -Fore 14 -No
Get-Date -Format "MM/d/yyyy hh:mm:ss tt"
''
Write-Host (($All_DCs_Sync | sort -Descending  LastReplicationSuccess | Out-String)).Trim()
''
$Newest_Sync = ($All_DCs_Sync.LastReplicationSuccess | sort -Descending)[0]
$Oldest_Sync = ($All_DCs_Sync.LastReplicationSuccess | sort -Descending)[-1]
Write-Host "Time between MOST recent, and LEAST recent:" -Fore 11
(($Newest_Sync - $Oldest_Sync) | Select Days, Hours, Minutes, Seconds | fl | Out-String).Trim()
}

SyncReport