r/usefulscripts • • Nov 03 '14

[BATCH] Tron v3.9.0 (2014-11-03) (add -m flag; bug fixes; purge Windows.old)

50 Upvotes

Background

Tron is a script that "fights for the User"; basically automates a bunch of scanning/disinfection/cleanup tools on a Windows system. I got tired of running these utilities manually and decided to just script the whole thing. I hope this helps other techs and admins.


Stages of Tron:

0. Prep: rkill, TDSSKiller, registry backup, WMI repair, sysrestore clean, oldest VSS set purge

  1. Tempclean: TempFileCleanup, CCLeaner, BleachBit, backup & clear event logs, Windows Update cache cleanup, Internet Explorer cleanup

  2. Disinfect: RogueKiller, Vipre Rescue Scanner, Sophos Virus Removal Tool, Malwarebytes Anti-Malware, DISM image check (Win8/2012 only), sfc /scannow

  3. De-bloat: removes a variety of OEM bloatware; customizable list is in \resources\stage_3_de-bloat\oem\programs_to_target.txt; Metro debloat (Win8/8.1/2012 only)

  4. Patch: Updates 7-Zip, Java, and Adobe Flash/Reader and disables nag/update screens (uses some of our PDQ packs); then installs any pending Windows updates

  5. Optimize: chkdsk (if necessary), Defrag %SystemDrive% (usually C:); skipped if system drive is an SSD

  6. Manual stuff: Contains additional optional tools that can't currently be automated (ComboFix, AdwCleaner, aswMBR, autoruns, etc.)

Saves a log to C:\Logs\tron.log (configurable).


Example Screenshots

Welcome Screen | New version detected | Help | Config dump | Dry run


Changelog (full changelog on Github)

v3.9.1 (2014-11-04)

  • ! tron.bat:bugfix: Fix crash error on Windows Vista Ultimate in Metro de-bloat section. Was crashing on string comparison due to "(TM)" symbols in Vista Ultimate name. Sigh

  • ! tron.bat:bugfix: Fix broken shutdown command at end of script. Will now correctly auto-shutdown if requested

  • ! tron.bat:bugfix: Fix logic error where we skipped calculating free hard drive space if the system drive was an SSD. Now detect free space regardless of disk type

  • These fixes and many more are in the upcoming v4.0.0, but these seemed critical enough to backport

v3.9.0 (2014-11-03)

  • + tron.bat:feature: Add -m flag and associated PRESERVE_METRO_APPS variable to preserve default Metro apps (don't remove them). Thanks to /u/swtester

  • ! tron.bat:bugfix: Fix calculation of free space before and after. Was missing code block for post-run space calculation. Thanks to /u/swtester

  • ! tron.bat:bugfix: Fix a registry modification that mistakenly executed even if the script was in dry run mode (-d)

  • ! tron.bat:bugfix: Fix broken Adobe Flash installer (Firefox)

  • / tron.bat:misc: Rename all instances of DO_SHUTDOWN to AUTO_SHUTDOWN


Download

Three download options:

  1. Primary: Mirror the BT Sync repo (get fixes/updates immediately) using the read-only key:

    BYQYYECDOJPXYA2ZNUDWDN34O2GJHBM47

    Make sure the settings for your Sync folder look like this (or this on the v1.3.x version).

  2. Download a self-extracting .exe pack from one of the mirrors:

MirrorHTTPHTTPSHost
Officiallinklink/u/SGC-Hosting

1 | link | link | /u/ellisgeek

2 | --- | link | /u/danodemano

3 | link (geolocated) | --- | /u/andrewthetechie

4 | link | --- | /u/jamesrascal

3. Script only:

If you want to preview the latest code, the master script is available **[here on Github](https://github.com/vocatus/tron/blob/master/tron.bat)** (Note: this is *only* the script and doesn't include the utilities Tron relies on to function).

Command-Line Support

Tron has full command-line support. All flags are optional, can be combined, and override their respective script default when used.

Usage: tron.bat [-a -c -d -m -o -p -r -s -v -x] | [-h]

Optional flags (can be combined):
 -a  Automatic mode (no welcome screen)
 -c  Config dump (display current config. Can be used with other
     flags to see what WOULD happen, but script will never execute
     if this flag is used)
 -d  Dry run (run through script but don't execute any jobs)
 -m  Preserve default Metro apps (don't remove them)
 -o  Power off after running (overrides -r if used together)
 -p  Preserve power settings (don't reset power settings to default)
 -r  Reboot automatically (auto-reboot 30 seconds after completion)
 -s  Skip defrag (force Tron to ALWAYS skip Stage 5 defrag)
 -v  Verbose. Display as much output as possible. NOTE: Significantly slower!
 -x  Self-destruct. Tron deletes itself after running and leaves logs intact

Misc flags (must be used alone)
 -h  Display this help text

Integrity

checksums.txt contains SHA-256 checksums for every file and is signed with my PGP key (0x82A211A2; included). You can use this to verify package integrity if necessary.

Please suggest modifications and fixes; community input is helpful and appreciated.


Tips: 1JZmSPe1MCr8XwQ2b8pgjyp2KxmLEAfUi7

Quiet ^Professionals


r/usefulscripts • • Aug 07 '22

[PowerShell] Reporting group membership for critical Active Directory groups

49 Upvotes

Had some time today to write another blog post about one of the functions of my ADEssentials Powershell module.

Blog post: https://evotec.xyz/reporting-group-membership-for-critical-active-directory-groups/

The blog could probably end with just this Reddit post saying please use install-module and Show-WinADGroupCritical to get pretty nice pictures and tables, but as always, I wanted to add a few more words.

You can then choose the long way or the short way:

Install-Module ADEssentials

Show-WinADGroupCritical -Verbose

For sources: https://github.com/EvotecIT/ADEssentials

Btw. the module has 80 or so commands that are mostly useful for AD.


r/usefulscripts • • Jan 27 '21

[PowerShell] Simple Windows backup script I wrote for my personal server

49 Upvotes

This script backs up an arbitrary number of drives to a single backup drive using robocopy. You can optionally include a list of folders you can specify in the script, currently just your user account's Downloads and Documents folders. You can also include a system backup, but a unique thing about my server is that I run a VMware Workstation Player VM on my C: drive, so I require that the VM be shutdown if including a system backup (or the whole server will crash) -- the script accounts for this and shuts down running VMs gracefully. On the backup target drive a folder is created for each of the drives being backed up and it logs the backup progress to a text file. I've tried to keep the features generalized.

I originally wrote it out of shame that I had been backing up my server by simply dragging folders in File Explorer, one drive at a time, but it's improved significantly over time. Hopefully someone else will find it useful, or point out something I'm doing wrong; I'm sure some will find my code clumsy.

Here is what it looks like at the start. Here is the PasteBin for it.

Edit: Apparently I forgot to account for the size of the minutia folders. Updated PasteBin and screenshot.


r/usefulscripts • • Dec 16 '18

[Powershell] Get-ProductKey and Get-RemoteRegistryKey

49 Upvotes

These scripts were inspired by a Microsoft SAM audit, as a way to learn Powershell, and to improve on existing scripts (which I included credits for inside my scripts).

Link: https://github.com/mattcarras/Get-ProductKey

Description: Powershell cmdlet to retrieve product keys and OS information from local or remote system/s.

Link: https://github.com/mattcarras/Get-RemoteRegistryKey

Description: Powershell cmdlet which retrieves the value of a registry key for a local or remote computer, enabling Remote Registry service if required. Requires WMI access.


r/usefulscripts • • Jun 07 '22

[BASH] Create macOS installer DMG or ISO disk images for virtualization

Thumbnail
github.com
48 Upvotes

r/usefulscripts • • Nov 09 '20

[PowerShell] Introducing PSTeams 2.0 – Support for Adaptive Cards, Hero Cards, List Cards and Thumbnail Cards

48 Upvotes

Last week I've released new PSTeams with support for Adaptive Cards, Thumbnail Cards, Cards Lists, and Hero Cards. This week I've managed to write down some thoughts on how it works, what you can expect with some examples of how things look.

Blog with description (documentation of sorts): https://evotec.xyz/introducing-psteams-2-0-support-for-adaptive-cards-hero-cards-list-cards-and-thumbnail-cards/

Sources & More Examples: https://github.com/EvotecIT/PSTeams

All those examples are now possible - and more using PSTeams (with some limits). Let me know what you think. Any feedback is good :-)

Some code example:

New-AdaptiveCard -Uri $IncomingLink -VerticalContentAlignment center {
    New-AdaptiveContainer {
        New-AdaptiveTextBlock -Text "Microsoft Corporation" -Size Medium -Wrap
        New-AdaptiveTextBlock -Text "Nasdaq Global Select: MSFT" -Subtle -Spacing None -Wrap
        New-AdaptiveTextBlock -Text "Fri, May 3, 2019 1:00 PM"
    }
    New-AdaptiveContainer {
        New-AdaptiveColumnSet {
            New-AdaptiveColumn {
                New-AdaptiveTextBlock -Text "128.90" -Size ExtraLarge
                New-AdaptiveTextBlock -Text "▲ 2.69 USD (2.13%)" -Color Good -Spacing None
            } -Width Stretch
            New-AdaptiveColumn {
                New-AdaptiveFactSet {
                    New-AdaptiveFact -Title 'Open' -Value '127.42'
                    New-AdaptiveFact -Title 'High' -Value '129.43'
                    New-AdaptiveFact -Title 'Low' -Value '127.25'
                }
            } -Width Auto
        }
    } -Spacing None
} -Speak 'Microsoft stock is trading at $62.30 a share, which is down .32%' -Verbose

Installation:

Install-Module PSTeams
# Update-Module PSTeams

r/usefulscripts • • Jan 18 '18

[PowerShell] Find out where Office 365 users are logging in from

48 Upvotes

It's common for hackers to log into Office 365 tenants from unexpected countries.

Here are some scripts that you can run across your own, and your customers Office 365 tenants.

They'll export a list of users, and the locations that they've accessed Office 365 from in the last 30 days. It'll also export the user agent data that can help with any investigations.


r/usefulscripts • • Jul 26 '22

[PowerShell] Finding duplicate DNS records by IP Address

47 Upvotes

One of the guys on Reddit told me that the name of my earlier blog post, "Finding Duplicate DNS entries," was a bit misleading as he expected to search for duplicates using IP Address and not by HostName. I do like a challenge...

So today's blog post and function are just that: https://evotec.xyz/finding-duplicate-dns-records-by-ip-adress-using-powershell/ - searching duplicates in DNS by Ip Address.

Sources for the command: https://github.com/EvotecIT/ADEssentials/blob/master/Public/Get-WinDNSIPAddresses.ps1

Module with lots of other useful commands for AD: https://github.com/EvotecIT/ADEssentials

Usage, as always as straightforward as it gets as long as you have ADEssentials/PSWriteHTML installed.

Get-WinDNSIPAddresses -Prettify -IncludeDetails | Out-HtmlView -Filtering

For a bit more advanced HTML output but still easy with conditional highlights

# Install module should be only done once, unless you want to update to newest version
Install-Module PSWriteHTML -Force -Verbose -Scope CurrentUser

# import module should be done every time you want to use it, although PowerShell autoloads most PowerShell modules
Import-Module PSWriteHTML -Force


# Gather data
$DNSByName = Get-WinDNSRecords -Prettify -IncludeDetails
$DNSByIP = Get-WinDNSIPAddresses -Prettify -IncludeDetails
# Create HTML :-)
New-HTML {
    New-HTMLTab -Name "DNS by Name" {
        New-HTMLTable -DataTable $DNSByName -Filtering {
            New-HTMLTableCondition -Name 'Count' -ComparisonType number -Value 1 -BackgroundColor LightGreen
            New-HTMLTableCondition -Name 'Count' -ComparisonType number -Value 1 -Operator gt -BackgroundColor Orange
            New-HTMLTableConditionGroup -Logic AND {
                New-HTMLTableCondition -Name 'Count' -ComparisonType number -Value 1 -Operator gt
                New-HTMLTableCondition -Name 'Types' -Operator like -ComparisonType string -Value 'static'
                New-HTMLTableCondition -Name 'Types' -Operator like -ComparisonType string -Value 'dynamic'
            } -BackgroundColor Rouge -Row -Color White
        } -DataStore JavaScript
    }
    New-HTMLTab -Name 'DNS by IP' {
        New-HTMLTable -DataTable $DNSByIP -Filtering {
            New-HTMLTableCondition -Name 'Count' -ComparisonType number -Value 1 -BackgroundColor LightGreen
            New-HTMLTableCondition -Name 'Count' -ComparisonType number -Value 1 -Operator gt -BackgroundColor Orange
            New-HTMLTableConditionGroup -Logic AND {
                New-HTMLTableCondition -Name 'Count' -ComparisonType number -Value 1 -Operator gt
                New-HTMLTableCondition -Name 'Types' -Operator like -ComparisonType string -Value 'static'
                New-HTMLTableCondition -Name 'Types' -Operator like -ComparisonType string -Value 'dynamic'
            } -BackgroundColor Rouge -Row -Color White
        } -DataStore JavaScript
    }
} -ShowHTML -Online -TitleText "DNS Records" -FilePath $PSScriptRoot\DNSRecords.html

r/usefulscripts • • Jun 04 '22

[PowerShell] READING IIS LOGS WITH POWERSHELL

47 Upvotes

Hi,

I wanted to introduce you to a very small module called IISParser. IISParser is a PowerShell module to, as the name suggests read IIS logs and convert them to proper PowerShell objects.

Install-Module -Name IISParser -AllowClobber -Force

Usage:

Import-Module IISParser

Get-IISParsedLog -FilePath "C:\Support\GitHub\IISParser\Ignore\u_ex220507.log" | Select-Object -First 5 | Format-Table
Get-IISParsedLog -FilePath "C:\Support\GitHub\IISParser\Ignore\u_ex220507.log" | Select-Object -Last 5 | Format-Table
Get-IISParsedLog -FilePath "C:\Support\GitHub\IISParser\Ignore\u_ex220507.log" -First 5 -Last 5 -Skip 1 | Format-Table

Blog post: https://evotec.xyz/reading-iis-logs-with-powershell/

Sources: https://github.com/EvotecIT/IISParser

It only contains a single cmd, as it was created based on a Twitter post.


r/usefulscripts • • May 02 '18

[POWERSHELL] Roku PS Modules and Remote GUI.

47 Upvotes

As a little side project to learn Powershell better, I created a Roku powershell module and corresponding Roku remote GUI.

https://i.imgur.com/eDfBERJ.png

You should just be able to download the entire project as a zip, unpack it wherever, and run Roku-remotegui.ps1

https://github.com/smithcbp/Powershell-Roku-Remote

The favorite apps listed at the bottom can be changed by modifying the $FavApps array at the top of Roku-RemoteGUI.ps1. Find the app names with:

Import-Module ./roku-remote-psm1
Get-RokuApp -ip $IP

Edit: Added keyboard shortcuts. Press ? in the remote GUI to view them.

Edit 2: https://i.imgur.com/IzZsQgQ.png

I have added quite a few new features including:

Edit 3: Added a button Add Roku by IP address instead of searching automatically. https://i.imgur.com/5O00fUR.png


r/usefulscripts • • Mar 22 '18

[Batch] Simple network diagnostic script for a remote user to provide info to you

47 Upvotes

This is useful for when you have a remote user who can't connect to the VPN or citrix or whatever, and you have no idea what their home networking situation is like.

Just have them run this script (no admin creds required) and it will create a text file on their desktop.
It tests and reports on the following:

  • Ping public sites by IP address to test for internet connection

  • Ping public sites by hostname to test for DNS issues

  • Detect and attempt to ping the default gateway

  • Check whether wlansvc is running and whether they are connected to a WLAN

  • Scan for self assigned IP addresses (169.254.x.x)

  • Show which adapters are disabled, connected, or disconnected

And finally it will record the results of an IPCONFIG /ALL for good measure.

All they have to do is send you the log results and you can probably figure it out from there. The results are logged to a text file on their desktop (which they have to find a way to send to you).

Public IPs used: 8.8.8.8, 4.2.2.2, and 192.0.43.10 (I found out about the last one in this thread

Version 1
https://pastebin.com/9rxfHLBz

Version 2:
Cleaner output, slightly less code https://pastebin.com/VJSsCHFQ


r/usefulscripts • • Aug 10 '22

[PowerShell] PowerShell Module to work with Virus Total in easy way

46 Upvotes

For the last few days, I've worked on a new PowerShell module that works on Windows PowerShell and PowerShell 7. It allows reading information from Virus Total using the free v3 API they provide.

Sources: https://github.com/EvotecIT/VirusTotalAnalyzer

Blog post: https://evotec.xyz/working-with-virustotal-from-powershell/

The usage:

$VTApi = "API"

$T1 = Get-VirusReport -ApiKey $VTApi -Hash 'BFF77EECBB2F7DA25ECBC9D9673E5DC1DB68DCC68FD76D006E836F9AC61C547E'
$T2 = Get-VirusReport -ApiKey $VTApi -File "$PSScriptRoot\Submisions\TestFile.txt"
$T3 = Get-VirusReport -ApiKey $VTApi -DomainName 'evotec.xyz'
$T4 = Get-VirusReport -ApiKey $VTApi -IPAddress '1.1.1.1'
$T5 = Get-VirusReport -ApiKey $VTApi -Search "https://evotec.xyz"

To send:

$VTApi = "API"

# Submit file to scan
$Output = New-VirusScan -ApiKey $VTApi -File "$PSScriptRoot\Submisions\TestFile.txt"
$Output | Format-List

Start-Sleep -Seconds 120

# Since the output will return scan ID we can use it to get the report
$OutputScan = Get-VirusReport -ApiKey $VTApi -AnalysisId $Output.data.id
$OutputScan | Format-List
$OutputScan.Meta | Format-List
$OutputScan.Data | Format-List

Enjoy


r/usefulscripts • • Dec 30 '19

PowerShell: Finding (and Exporting) Active Directory Group Members and Groups

46 Upvotes

Hey guys, I just wrote a shiny new blog post you may enjoy.

Summary: Learn how to use PowerShell to get AD group members, groups and export them in this step-by-step article.

https://adamtheautomator.com/powershell-get-ad-group-members/

If you'd like to write posts like this, get promoted and get paid, join us! https://adamtheautomator.com/friends


r/usefulscripts • • Apr 22 '19

[PowerShell] Office 365 Health Service information

46 Upvotes

Here's a PowerShell Module: https://evotec.xyz/powershell-way-to-get-all-information-about-office-365-service-health/ that I've written that allows you to download Office 365 Health Status, the same you see when logging in as admin.

Usage:

Import-Module PSWinDocumentation.O365HealthService -Force

$ApplicationID = ''
$ApplicationKey = ''
$TenantDomain = 'evotec.pl'

$O365 = Get-Office365Health -ApplicationID $ApplicationID -ApplicationKey $ApplicationKey -TenantDomain $TenantDomain
$O365

It's preprocessed to provide HashTable with lots of information divided in sections. Here's a simple HTML file showing all data it contains: https://evotec.xyz/wp-content/uploads/2019/04/Health.html


r/usefulscripts • • Apr 12 '19

[PowerShell] Meet Emailimo - Easy way to send prettified emails in PowerShell

46 Upvotes

Today I wanted to present a little PowerShell module that makes it easy to send emails. Full overview with examples can be found https://evotec.xyz/meet-emailimo-new-way-to-send-pretty-emails-with-powershell/

What is it about? It's supposed to make it clearly visible what you're trying to send with Powershell so that when you look back at your code in 6 months time you know what is going on and you can fix any formatting as you want it.

Import-Module PSWriteHTML -Force
Import-Module Emailimo -Force
### Prepare your data:
$UserNotify = 'Przemysław Kłys'
$PasswordExpiryDays = 5
Email -WhatIf {
    EmailHeader {
        EmailFrom -Address '[email protected]'
        EmailTo -Addresses "[email protected]"
        EmailServer -Server 'mail.evotec.com' -UserName 'YourUsername' -Password 'C:\Support\Important\Password-Evotec-Reminder.txt' -PasswordAsSecure -PasswordFromFile
        EmailOptions -Priority High -DeliveryNotifications Never
        EmailSubject -Subject 'This is a test email'
    }
    EmailBody -FontFamily 'Calibri' -Size 15 {
        EmailTextBox {
            "Hello $UserNotify,"
            ""
            "Your password is due to expire in $PasswordExpiryDays days."
            ""
            'To change your password: '
            '- press CTRL+ALT+DEL -> Change a password...'
            ''
            'If you have forgotten your password and need to reset it, you can do this by clicking here. '
            "In case of problems please contact the HelpDesk by visiting [Evotec Website](https://evotec.xyz) or by sending an email to Help Desk."
            ''
            'Alternatively you can always call Help Desk at +48 22 00 00 00'
            ''
            'Kind regards,'
            'Evotec IT'
        }
        EmailText -LineBreak
    }

Example 2:

Import-Module PSWriteHTML -Force
Import-Module Emailimo -Force
### Prepare your data:
$UserNotify = 'Przemysław Kłys'
$PasswordExpiryDays = 5
Email {
    EmailHeader {
        EmailFrom -Address '[email protected]'
        EmailTo -Addresses "[email protected]"
        EmailServer -Server 'mail.evotec.com' -UserName 'UserName' -Password 'C:\Support\Important\Password-Evotec-Reminder.txt' -PasswordAsSecure -PasswordFromFile
        EmailOptions -Priority High -DeliveryNotifications Never
        EmailSubject -Subject 'This is a test email'
    }
    EmailBody -FontFamily 'Calibri' -Size 15 {
        EmailText -Text "Hello ", $UserNotify, "," -Color None, Blue, None -Verbose -LineBreak
        EmailText -Text "Your password is due to expire in ", $PasswordExpiryDays, "days." -Color None, Green, None
        EmailText -LineBreak
        EmailText -Text 'To change your password: '
        EmailText -Text '- press ', 'CTRL+ALT+DEL', ' -> ', 'Change a password...' -Color None, BlueViolet, None, Red
        EmailText -LineBreak
        EmailTextBox {
            'If you have forgotten your password and need to reset it, you can do this by clicking here. '
            "In case of problems please contact the HelpDesk by visiting [Evotec Website](https://evotec.xyz) or by sending an email to Help Desk."
        }
        EmailText -LineBreak
        EmailText -Text 'Alternatively you can always call ', 'Help Desk', ' at ', '+48 22 00 00 00' `
            -Color None, LightSkyBlue, None, LightSkyBlue -TextDecoration none, underline, none, underline -FontWeight normal, bold, normal, bold
        EmailText -LineBreak
        EmailTextBox {
            'Kind regards,'
            'Evotec IT'
        }
    }
}

r/usefulscripts • • Nov 22 '16

[Batch] A script to view the wireless SSIDs and security keys stored on this computer

46 Upvotes

Very simple to use, even for end users. Displays a list of SSIDs and allows the user to choose one to display the security key for.

Version 3: http://pastebin.com/CAEu4RLd

  • Added more accurate error detection.

  • Fixed a bug where it would detect SSIDs that contained the user's input. It now only finds exact matches.

  • Added the ability to remove profiles(i.e. Delete a saved ssid and key). Included error detection for this feature as well.

minor known issue: This script is unable to delete profiles with SSIDs containing special characters, such "Joe's Phone Hotspot". It will simply not be able to find the profile during the deletion step.

Version 2
(updated the comments to be more clear, but code is still the same)
http://pastebin.com/aNvSTa70

~~Version 1
http://pastebin.com/i8szY1aS


r/usefulscripts • • Aug 14 '16

[CSV File] FCC Telemarketer and RoboCall Blacklist 20160813

46 Upvotes

After 4 months of having life take over, I have finally updated my pull script to generate the Google Contacts CSV. This list is now a whopping 110,713 numbers, with 554 contacts at 200 numbers each. Due to this:

I DO NOT GUARANTEE THIS WILL WORK ON YOUR PHONE!

I really don't suggest trying to import this list into your Google Contacts anymore. It's simply an insane amount of numbers to slap into your phone's database.

However, after a suggestion from /u/CycoPenguin, I will be generating a FreePBX Blacklist CSV for import. If anyone wants any other formats for other PBX systems, just shoot me a message with its basic template.


Primary 20160813 : https://pastebin.com/0mHE5Chk

FreePBX 20160813 : https://pastebin.com/4SAbdUPy


!WARNING!

Some Android apps will have issues!

Here are the ones that are known:

  • Telegram

  • WhatsApp

  • Hangouts (from /u/bugalou, but need another to confirm)

If an app checks the status of ALL contacts (not just app specific), you'll be in for a bad time.


  1. Copy & paste the pastebin content to notepad

  2. Save As .csv

  3. Go to www.google.com/contacts

  4. Import (might complain, and switch you to the "old" interface)

  5. Select the .csv you made, and upload!

If you don't see them immediately, refresh the page, don't try to upload again!


Options to Block:

  1. Use Google Voice to redirect the Spammers group directly to voicemail

  2. Use Root Call Blocker to reject calls from the Spammers group (Thanks to /u/Toribor)

  3. Like #1, but instead of voicemail, redirect them to Lenny! (Thanks to /u/Enxer)

  1. ....Suggestions?


You can find out more, and file a complaint with the FCC here: https://consumercomplaints.fcc.gov/hc/en-us/articles/202916660

For those who want the raw data from the FCC, you can get it from here: https://opendata.fcc.gov/d/tkbm-mngi

You can also watch my Pastebin account for updates: https://pastebin.com/u/Harshmage/


r/usefulscripts • • Oct 29 '14

[BATCH] Tron v3.8.0 (2014-10-29) (add self-destruct flag; fix WU cache clean; switch to .exe pack)

46 Upvotes

Background

Tron is a script that "fights for the User"; basically automates a bunch of scanning/disinfection/cleanup tools on a Windows system. I got tired of running these utilities manually on individual machines, and decided to just script the whole thing. I hope this helps other techs and admins.


Stages of Tron:

0. Prep: rkill, TDSSKiller, registry backup, WMI repair, sysrestore clean, oldest VSS set purge

  1. Tempclean: TempFileCleanup, CCLeaner, BleachBit, backup & clear event logs, Windows Update cache cleanup, Internet Explorer cleanup

  2. Disinfect: RogueKiller, Vipre Rescue Scanner, Sophos Virus Removal Tool, Malwarebytes Anti-Malware, DISM image check (Win8/2012 only), sfc /scannow

  3. De-bloat: removes a variety of OEM bloatware; customizable list is in \resources\stage_3_de-bloat\oem\programs_to_target.txt; removes default Metro apps (Win8/8.1/2012 only)

  4. Patch: Updates 7-Zip, Java, and Adobe Flash/Reader and disables nag/update screens (uses some of our PDQ packs); then installs any pending Windows updates

  5. Optimize: chkdsk (if necessary), Defrag %SystemDrive% (usually C:); skipped if system drive is an SSD

  6. Manual stuff: Contains additional optional tools that can't currently be automated (ComboFix, AdwCleaner, aswMBR, autoruns, etc.)

Saves a log to C:\Logs\tron.log (configurable).


Example Screenshots

Welcome Screen | New version detected | Help | Config dump | Dry run


Changelog (full changelog on Github)

v3.8.0 (2014-10-29)

  • / tron:META: Change Tron static packs from .7z archives to self-extracting .exe archives. Thanks to /u/cmorche

  • + tron.bat:feature: Add self-destruct flag (-x). If selected Tron will delete itself after running, while leaving logs intact. Thanks to /u/bodkov

  • * tron.bat:logging: Add display of disk free space before and after to log header and trailer, and associated variables. Thanks to /u/cuddlychops06

  • * tron.bat:logging: Minor logging tweak. Stamp any command-line flags that were used to header and trailer when running

  • * tron.bat:improvement: Make all IF comparisons case-insensitive. Thanks to /u/Astrimedes

  • - tron.bat:diskcheck: Remove SMART disk health check and associated variables. Too many incorrect detections causing more of a hassle than it's worth.

  • ! stage_1_tempclean: Fix Windows Update cache cleanup; Windows Update service wouldn't start in Safe Mode, now force it to start. Thanks to /u/GrizzlyWinter

  • * Misc updates: Updates to AV defs, ComboFix, etc


Download

Three download options:

  1. Primary: Mirror the BT Sync repo (get fixes/updates immediately) using the read-only key:

    BYQYYECDOJPXYA2ZNUDWDN34O2GJHBM47

    Make sure the settings for your Sync folder look like this (or this if you're on the v1.3.x version).

  2. Download a self-extracting .exe pack from one of the mirrors:

MirrorHTTPHTTPSHost
Officiallinklink/u/SGC-Hosting

1 | link | link | /u/ellisgeek

2 | --- | link | /u/danodemano

3 | link (geolocated) | --- | /u/andrewthetechie

4 | link | --- | /u/jamesrascal

3. Script only:

If you want to preview the latest code, the master script is available **[here on Github](https://github.com/vocatus/tron/blob/master/tron.bat)** (Note: this is *only* the script and doesn't include the utilities Tron relies on to function).

Command-Line Support

Tron has full command-line support. All flags are optional, can be combined, and override their respective script default when used.

Usage: tron.bat [-a -c -d -o -p -r -s -v -x] | [-h]

Optional flags (can be combined):
 -a  Automatic/silent mode (no welcome screen)
 -c  Config dump (display current config. Can be used with other
     flags to see what WOULD happen, but script will never execute
     if this flag is used)
 -d  Dry run (run through script but don't execute any jobs)
 -o  Power off after running (overrides -r if used together)
 -p  Preserve power settings (don't reset power settings to default)
 -r  Reboot automatically (auto-reboot 30 seconds after completion)
 -s  Skip defrag (force Tron to ALWAYS skip Stage 5 defrag)
 -v  Verbose. Display as much output as possible. NOTE: Significantly slower!
 -x  Self-destruct. Tron deletes itself after running and leaves logs intact

Misc flags (must be used alone)
 -h  Display this help text

Integrity

checksums.txt contains SHA-256 checksums for every file and is signed with my PGP key (0x82A211A2; included). You can use this to verify package integrity if necessary.

Please suggest modifications and fixes; community input is helpful and appreciated.


Tips: 1JZmSPe1MCr8XwQ2b8pgjyp2KxmLEAfUi7

Quiet ^Professionals


r/usefulscripts • • Apr 30 '14

[POWERSHELL] My Most Useful script yet... Ryan's AD Toolbox

46 Upvotes

Created this to make my life a bit easier when working with hundreds of AD accounts, and performing quick audits on user accounts... Hopefully you guys find this as useful as I did :) Feel free to post any questions you may have.

http://tehrabbitt.com/index.php?content=scripts&type=radtool


r/usefulscripts • • Sep 08 '19

[PowerShell] Testimo - PowerShell module for Active Directory Health Checks

45 Upvotes

Some time ago I've decided I'm a bit too lazy for manual verification of my Active Directory when it comes to doing Health Checks. I've caught myself a few times where I've configured 4 out of 5 Domain Controllers thinking everything is running great. While there are "pay" tools on the market I've usually no budget. And when you search for Active Directory Health Checks you can find a lot of blog posts covering Active Directory Health Checks. However, everyone treats every health check separately. If you want to test 20 different things you're gonna spend next 8 hours doing just that. And when you're done you should start all over the next day because something may have changed.

I wrote a PowerShell module called Testimo which bundles a lot of Active Directory checks and make it easy to expand on. It targets Forest/Domain and all it's Domain Controllers. It has reporting built-in. It's able to work ad-hoc to asses someone else directory and find what's misconfigured, but also has advanced configured which can test your AD against given specific settings.

Following "health" checks are added for now. I do intend to add more as I go. It's quite easy to add more sources/tests so if you wanna help out - please do. Of course, I may have done a few misconfigurations, some errors while putting it all together - so make sure to let me know via GitHub issues if you think some settings are incorrect and should be changed.

  • Forest Backup – Verify last backup time should be less than X days

  • Forest Replication – Verify each DC in replication site can reach other replication members

  • Forest Optional Features – Verify Optional Feature Recycle Bin should be Enabled

  • Forest Optional Features- Verify Optional Feature Privileged Access Management Feature should be Enabled

  • Forest Optional Features – Verify Optional Feature Laps should be enabled Configured

  • Forest Sites Verification Verify each site has at least one subnet configured

  • Forest Sites Verification Verify each site has at least one domain controller configured

  • Forest Site Links – Verify each site link is automatic

  • Forest Site Links – Verify each site link uses notifications

  • Forest Site Links- Verify each site link does not use notifications

  • Forest Roles Verify each FSMO holder is reachable

  • Forest Orphaned/Empty Admins – Verify there are no Orphaned Admins (users/groups/computers)

  • Forest Tombstone Lifetime – Verify Tombstone lifetime is greater or equal 180 days

  • Domain Roles Verify each FSMO holder is reachable

  • Domain Password Complexity Requirements – Verify Password Complexity Policy should be Enabled

  • Domain Password Complexity Requirements – Verify Password Length should be greater than X

  • Domain Password Complexity Requirements – Verify Password Threshold should be greater than X

  • Domain Password Complexity Requirements – Verify Password Lockout Duration should be greater than X minutes

  • Domain Password Complexity Requirements – Verify Password Lockout Observation Window should be greater than X minutes

  • Domain Password Complexity Requirements – Verify Password Minimum Age should be greater than X

  • Domain Password Complexity Requirements – Verify Password History Count should be greater than X

  • Domain Password Complexity Requirements – Verify Password Reversible Encryption should be Disabled

  • Domain Trust Availability – Verify each Trust status is OK

  • Domain Trust Unconstrained TGTDelegation – Verify each Trust TGTDelegation is set to True

  • Domain Kerberos Account Age – Verify Kerberos Last Password Change Should be less than 180 days

  • Domain Groups: Account Operators – Verify Group is empty

  • Domain Groups: Schema Admins – Verify Group is empty

  • Domain User: Administrator – Verify Last Password Change should be less than 360 days or account disabled

  • Domain DNS Forwarders – Verify DNS Forwarders are identical on all DNS nodes

  • Domain DNS Scavenging Primary DNS Server – Verify DNS Scavenging is set to X days

  • Domain DNS Scavenging Primary DNS Server – Verify DNS Scavenging State is set to True

  • Domain DNS Scavenging Primary DNS Server – Verify DNS Scavenging Time is less than X days

  • Domain DNS Zone Aging – Verify DNS Zone Aging is set

  • Domain Well known folder – UsersContainer  Verify folder is not at it's defaults.

  • Domain Well known folder – ComputersContainer  Verify folder is not at it's defaults.

  • Domain Well known folder – DomainControllersContainer Verify folder is at it's defaults.

  • Domain Well known folder – DeletedObjectsContainer Verify folder is at it's defaults.

  • Domain Well known folder – SystemsContainer Verify folder is at it's defaults.

  • Domain Well known folder – LostAndFoundContainer Verify folder is at it's defaults.

  • Domain Well known folder – QuotasContainer Verify folder is at it's defaults.

  • Domain Well known folder – ForeignSecurityPrincipalsContainer Verify folder is at it's defaults.

  • Domain Orphaned Foreign Security Principals – Verify there are no orphaned FSP objects.

  • Domain Orphaned/Empty Organizational Units – Verify there are no orphaned Organizational Units

  • Domain Group Policy Missing Permissions – Verify Authenticated Users/Domain Computers are on each and every Group Policy

  • Domain DFSR Sysvol – Verify SYSVOL is DFSR

  • Domain Controller Information – Is Enabled

  • Domain Controller Information – Is Global Catalog

  • Domain Controller Service Status – Verify all Services are running

  • Domain Controller Service Status – Verify all Services are set to automatic startup

  • Domain Controller Service Status (Print Spooler) – Verify Print Spooler Service is set to disabled

  • Domain Controller Service Status (Print Spooler) – Verify Print Spooler Service is stopped

  • Domain Controller Ping Connectivity – Verify DC is reachable

  • Domain Controller Ports – Verify Following ports 53, 88, 135, 139, 389, 445, 464, 636, 3268, 3269, 9389 are open

  • Domain Controller RDP Ports – Verify Following ports 3389 (RDP) is open

  • Domain Controller RDP Security – Verify NLA is enabled

  • Domain Controller LDAP Connectivity – Verify all LDAP Ports are open

  • Domain Controller LDAP Connectivity – Verify all LDAP SSL Ports are open

  • Domain Controller Windows Firewall – Verify windows firewall is enabled for all network cards

  • Domain Controller Windows Remote Management – Verify Windows Remote Management identification requests are managed

  • Domain Controller Resolves internal DNS queries – Verify DNS on DC resolves Internal DNS

  • Domain Controller Resolves external DNS queries – Verify DNS on DC resolves External DNS

  • Domain Controller Name servers for primary domain zone Verify DNS Name servers for primary zone are identical

  • Domain Controller Responds to PowerShell Queries Verify DC responds to PowerShell queries

  • Domain Controller TimeSettings – Verify PDC should sync time to external source

  • Domain Controller TimeSettings – Verify Non-PDC should sync time to PDC emulator

  • Domain Controller TimeSettings – Verify Virtualized DCs should sync to hypervisor during boot time only

  • Domain Controller Time Synchronization Internal – Verify Time Synchronization Difference to PDC less than X seconds

  • Domain Controller Time Synchronization External – Verify Time Synchronization Difference to pool.ntp.org less than X seconds

  • Domain Controller Disk Free – Verify OS partition Free space is at least X %

  • Domain Controller Disk Free – Verify NTDS partition Free space is at least X %

  • Domain Controller Operating System – Verify Windows Operating system is Windows 2012 or higher

  • Domain Controller Windows Updates – Verify Last patch was installed less than 60 days ago

  • Domain Controller SMB Protocols – Verify SMB v1 protocol is disabled

  • Domain Controller SMB Protocols – Verify SMB v2 protocol is enabled

  • Domain Controller SMB Shares – Verify default SMB shares NETLOGON/SYSVOL are visible

  • Domain Controller DFSR AutoRecovery – Verify DFSR AutoRecovery is enabled

  • Domain Controller Windows Roles and Features – Verify Windows Features for AD/DNS/File Services are enabled

I welcome all good/bad feedback.

- blog post with description: https://evotec.xyz/what-do-we-say-to-health-checking-active-directory/

- sources: https://github.com/EvotecIT/Testimo

It's an alpha product - but I've tested it on 3-4 AD's I have and so far it works ok. I've probably missed some things so if you find some bugs please let me know.


r/usefulscripts • • Aug 01 '16

[POWERSHELL] Using Malwaredomains.com DNS Black hole list with Windows 2012 DNS and Powershell

45 Upvotes

So this week I wrote Powershell integration for the malwaredomains.com txt list. They offer some instructions on how to set it up. There is also a powershell method that utilizes WMI

Those both are the "old methods." I decided since the DNS commands in powershell have improved a bit since that was written I would write a script that utilizes the new DNS commands.

The whole thing can be found on my github here

Pastebin for deploy

pastebin for roll back

pastebin for bonus hostfile generator

My blog with the writeup


r/usefulscripts • • Jul 24 '22

[PowerShell] Finding Duplicate DNS entries

44 Upvotes

Had an interesting work case a few days ago where it was required to quickly find DNS entries that have both static and dynamic entries in DNS and causing issues with connection. So I wrote this little command called Get-WinDNSRecords and added it to ADEssentials.

As with most of the things created by me:

Get-WinDNSRecords | Format-Table

Or

Get-WinDNSRecords -Prettify -IncludeDetails | Format-Table

This can be done straight after installing the ADEssentials module.


r/usefulscripts • • Apr 01 '21

[Powershell] My Profile.ps1 with self-update function

Thumbnail
gist.github.com
44 Upvotes

r/usefulscripts • • Dec 22 '19

[PowerShell] Sending messages to Microsoft Teams - updated features, updated syntax

44 Upvotes

So I have been using the PSTeams PowerShell module for a while now but ever since I've released PSWriteHTML I had this feeling that the syntax for PSTeams can be much better.

So over the weekend, I've worked to update it to new syntax (keeping the old one as is) along adding some new features.

Long story: https://evotec.xyz/sending-to-microsoft-teams-from-powershell-just-got-easier-and-better/

Short story:

$TeamsID = 'YourCodeGoesHere'
$Button1 = New-TeamsButton -Name 'Visit English Evotec Website' -Link "https://evotec.xyz"
$Fact1 = New-TeamsFact -Name 'PS Version' -Value "**$($PSVersionTable.PSVersion)**"
$Fact2 = New-TeamsFact -Name 'PS Edition' -Value "**$($PSVersionTable.PSEdition)**"
$Fact3 = New-TeamsFact -Name 'OS' -Value "**$($PSVersionTable.OS)**"
$CurrentDate = Get-Date
$Section = New-TeamsSection `
    -ActivityTitle "**PSTeams**" `
    -ActivitySubtitle "@PSTeams - $CurrentDate" `
    -ActivityImage Add `
    -ActivityText "This message proves PSTeams Pester test passed properly." `
    -Buttons $Button1 `
    -ActivityDetails $Fact1, $Fact2, $Fact3
Send-TeamsMessage `
    -URI $TeamsID `
    -MessageTitle 'PSTeams - Pester Test' `
    -MessageText "This text will show up" `
    -Color DodgerBlue `
    -Sections $Section

New code:

$TeamsID = ''
Send-TeamsMessage -URI $TeamsID -MessageTitle 'PSTeams - Pester Test' -MessageText "This text will show up" -Color DodgerBlue {
    New-TeamsSection {
        New-TeamsActivityTitle -Title "**PSTeams**"
        New-TeamsActivitySubtitle -Subtitle "@PSTeams - $CurrentDate"
        New-TeamsActivityImage -Image Add
        New-TeamsActivityText -Text "This message proves PSTeams Pester test passed properly."
        New-TeamsFact -Name 'PS Version' -Value "**$($PSVersionTable.PSVersion)**"
        New-TeamsFact -Name 'PS Edition' -Value "**$($PSVersionTable.PSEdition)**"
        New-TeamsFact -Name 'OS' -Value "**$($PSVersionTable.OS)**"
        New-TeamsButton -Name 'Visit English Evotec Website' -Link "https://evotec.xyz"
    }
}

or:

Send-TeamsMessage -Verbose {
    New-TeamsSection {
        ActivityTitle -Title "**Elon Musk**"
        ActivitySubtitle -Subtitle "@elonmusk - 9/12/2016 at 5:33pm"
        ActivityImageLink -Link "https://pbs.twimg.com/profile_images/782474226020200448/zDo-gAo0.jpg"
        ActivityText -Text "Climate change explained in comic book form by xkcd xkcd.com/1732"
    }
    New-TeamsSection {
        ActivityTitle -Title "**Mark Knopfler**"
        ActivitySubtitle -Subtitle "@MarkKnopfler - 9/12/2016 at 1:12pm"
        ActivityImageLink -Link "https://pbs.twimg.com/profile_images/1042367841117384704/YvrqQiBK_400x400.jpg"
        ActivityText -Text "Mark Knopfler features on B.B King's all-star album of Blues greats, released on this day in 2005..."
    }
    New-TeamsSection {
        ActivityTitle -Title "**Elon Musk**"
        ActivitySubtitle -Subtitle "@elonmusk - 9/12/2016 at 5:33pm"
        ActivityImageLink -Link "https://pbs.twimg.com/profile_images/782474226020200448/zDo-gAo0.jpg"
        ActivityText -Text "Climate change explained in comic book form by xkcd xkcd.com/1732"
    }
} -Uri $TeamsID -Color DarkSeaGreen -MessageSummary 'Tweet'

Hope this helps :-) Enjoy and happy Christmas!