r/usefulscripts • • Dec 10 '18

[Request] Script to display who and when permissions were edited on a folder.

30 Upvotes

Somebody removed 4 users with full control permissions on a folder and I need to know who made the changes to prevent this in the future.


r/usefulscripts • • Aug 30 '18

[PowerShell] Quickly deploy LAB Virtual Machines with the AutomatedLab PowerShell Framework

30 Upvotes

A quick video walk-through of the AutomatedLab PowerShell Framework (I'm not affiliated to the AutomatedLab team, I just use it often).

http://www.signalwarrant.com/quickly-deploy-lab-virtual-machines-with-the-automatedlab-powershell-framework/


r/usefulscripts • • Dec 11 '15

[CSV File] FCC Telemarketer and RoboCall Blacklist for Google Contacts (12/07/2015) - Yes, I'm late

Thumbnail
pastebin.com
30 Upvotes

r/usefulscripts • • Nov 09 '15

[CSV File] FCC Telemarketer and RoboCall Blacklist for Google Contacts (11/9/2015)

Thumbnail
pastebin.com
30 Upvotes

r/usefulscripts • • Sep 17 '15

[Batch] Extract MSI from exe installer

Thumbnail
pastebin.com
30 Upvotes

r/usefulscripts • • Apr 19 '15

[PowerShell] Find what computer a user is logged into

30 Upvotes

http://pastebin.com/sTNpgbDC

Add-PSSnapin Quest.ActiveRoles.ADManagement -ErrorAction SilentlyContinue

$ErrorActionPreference = "SilentlyContinue"

Function Get-Username {

$Global:Username = Read-Host "Enter username you want to search for"

if ($Username -eq $null){

Write-Host "Username cannot be blank, please re-enter username!"

Get-Username}

$UserCheck = Get-QADUser -SamAccountName $Username

if ($UserCheck -eq $null){

Write-Host "Invalid username, please verify this is the logon id for the account"

Get-Username} }

get-username

$computers = Get-QADComputer | where {$_.accountisdisabled -eq $false}

foreach ($comp in $computers)

      {

$Computer = $comp.Name

$ping = new-object System.Net.NetworkInformation.Ping

$Reply = $null

$Reply = $ping.send($Computer)

if($Reply.status -like 'Success'){

$proc = gwmi win32_process -computer $Computer -Filter "Name = 'explorer.exe'"

ForEach ($p in $proc) {

$temp = ($p.GetOwner()).User

if ($temp -eq $Username){

write-host "$Username is logged onto $Computer"

}}}}

Edit: forgot to mention quest active roles will be needed for this. You can download here: http://tinyurl.com/oukq26q


r/usefulscripts • • Feb 17 '23

GitHub - tg12/script-toolbox: This repository contains a collection of scripts and tools that I have written to solve various problems that I have come across.

Thumbnail
github.com
29 Upvotes

r/usefulscripts • • Feb 14 '22

[PowerShell] Office 365 Health Service using PowerShell

29 Upvotes

Just wrote a short blog post on the updated PowerShell module called PSWinDocumentation.O365HealthService. It allows gathering Health data from Office 365 with Graph API.

Import-Module PSWinDocumentation.O365HealthService -Force
$ApplicationID = ''
$ApplicationKey = ''
$TenantDomain = 'evotec.pl' # CustomDomain (onmicrosoft.com won't work), alternatively you can use DirectoryID
$O365 = Get-Office365Health -ApplicationID $ApplicationID -ApplicationKey $ApplicationKey -TenantDomain $TenantDomain
$O365

Blog post: https://evotec.xyz/office-365-health-service-using-powershell/

Sources: https://github.com/EvotecIT/PSWinDocumentation.O365HealthService


r/usefulscripts • • Apr 16 '21

Script sharing: Export Office 365 groups a user is member of

29 Upvotes

The administrators require the Office 365 user membership report to manage and maintain the organization and business. So, I have created a PowerShell script to address various business situations. With this script, you can generate 10 different user membership reports based on your requirement.

Few of the use cases :

  • Lists all users with their groups

  • Gets group membership details for list of users (input through CSV)

  • Shows guest users and their membership

  • Shows disabled users with their group membership

  • Identify users who are not member of any groups

You can download the script from the github


r/usefulscripts • • Feb 25 '20

[TERRAFORM] Backup tagged EC2 instances as AMIs

Thumbnail
github.com
29 Upvotes

r/usefulscripts • • Aug 11 '19

[PowerShell] Formatting and minifying resources (HTML, CSS, JavaScript)

29 Upvotes

So I was wondering on Friday if I can format my HTML produced by PSWriteHTML module. Turns out it's quite possible. After some busy Saturday/Sunday please welcome PSParseHTML module.

I am not sure how useful it will be outside of a few specific cases but I needed it for my own curiosity, I may as well share this.

It has 7 functions:

  • Optimize-CSS

  • Optimize-HTML

  • Optimize-JavaScript

  • Format-CSS

  • Format-HTML

  • Format-JavaScript

  • Convert-HTMLToText

Generally speaking it can format CSS/HTML/JS or minify those. Also it can extract text from HTML code.

Enjoy ;-)


r/usefulscripts • • Jul 14 '19

[PowerShell] Using Lansweeper with PowerShell to your advantage

29 Upvotes

For those that have Lansweeper at work, I wrote this little PowerShell module that can get any Lansweeper report into PowerShell object so you can interact with Lansweeper data in PowerShell. It's a really small project (about 80 lines of code) but you can get lots of ready to go reports.

Usage

Get-LansweeperReport -SqlInstance "LANSWEEPER.AD.EVOTEC.XYZ" -Report SoftwareLicenseKeyOverview | Format-Table -Autosize
Get-LansweeperReport -SqlInstance "LANSWEEPER.AD.EVOTEC.XYZ" -Report InstalledWindowsUpdates | Format-Table -Autosize

Or

$Test = Get-LansweeperReport -SqlInstance "LANSWEEPER.AD.EVOTEC.XYZ" -Report WindowsAutomaticUpdateSettingsAudit
$Test | Format-Table *

$Test = Get-LansweeperReport -SqlInstance "LANSWEEPER.AD.EVOTEC.XYZ" -Report WindowsAutomaticUpdateSettingsAudit,MicrosoftPatchTuesdayAuditJuly2019
$Test.WindowsAutomaticUpdateSettingsAudit | Format-Table -AutoSize
$Test.MicrosoftPatchTuesdayAuditJuly2019 | Format-Table -AutoSize

Here's couple of screenshots.


r/usefulscripts • • Mar 10 '19

[PowerShell] PSWinReporting 1.8 - Split of branches (Legacy vs. New Hope)

Thumbnail
evotec.xyz
29 Upvotes

r/usefulscripts • • Oct 25 '18

[PowerShell] PSAutomator - Offboarding / Onboarding / BAU module in form of IFTTT / Microsoft Flow

29 Upvotes

This PowerShell Module is new approach to onboarding, offboarding and business as usual processes running in companies infrastructure. Usually each company has different rules, different approaches on how processes should look like. This module at this moment can do following things:

  • Add/Remove account to/from a specific group

  • Disable/Enable Account

  • Hide/Show account in GAL

  • Remove All Groups

  • Remove All Distribution or Security Groups

  • Remove All Local, Global or Universal Groups

  • Make snapshot/backup of account configuration

  • Add/Remove Text from Account Fields

  • Rename Account

Current version 0.0.3 and as such is very alpha. Comments are welcome.

Overview: https://evotec.xyz/hub/scripts/psautomator-powershell-module/

It's work in progress. New actions/ignores/conditions and services will be added. Currently only has AD but will support Exchange/O365 and if there will be need other things as well.

Sample looks like this:

Clear-Host
Import-Module PSAutomator -Force #-Verbose
Import-Module PSSharedGoods -Force

Service -Name 'Active Directory Offboarding' {
    Trigger -Name 'OU Offboarded Users' -User OrganizationalUnit -Value 'OU=Users-Offboarded,OU=Production,DC=ad,DC=evotec,DC=xyz' |
        Condition -Name 'No conditions' |
        Ignore -Name 'Ignore Windows Email Address if Empty or null' -Ignore MatchingEmptyOrNull -Value EmailAddress |
        Action -Name 'Make User Snapshot' -ActiveDirectory AccountSnapshot -Value 'C:\Users\pklys\Desktop\MyExport' -Whatif |
        Action -Name 'Disable AD Account' -ActiveDirectory AccountDisable -WhatIf |
        Action -Name 'Hide account in GAL' -ActiveDirectory AccountHideInGAL -WhatIf  |
        Action -Name 'Remove all security groups' -ActiveDirectory AccountRemoveGroupsSecurity -WhatIf |
        Action -Name 'Rename Account' -ActiveDirectory AccountRename -Value @{ Action = 'AddText'; Where = 'After'; Fields = 'DisplayName', 'Name'; Text = ' (offboarded)'; } -WhatIf
}

r/usefulscripts • • Jun 02 '18

[BASH]Twitch Script

29 Upvotes

Hey folks,

Any Twitch viewer here? Personnaly I like watching streams but I hate to open the browser and click on things to go on a ugly and unoptimized website with ads just to check if my favorites streamers are offline or not.

So I made a script to do that for me

Thoses scripts aren't perfect. I'm relatively new in bash scripting and I'm sure it's possible to improve these. If you have any comment/advice.


r/usefulscripts • • Oct 31 '17

[Request] Some AD management. Disable account, update description and move OU.

29 Upvotes

Normally I figure this sort of thing out on my own but haven't been able to get anywhere.

At the company we work for we have a pretty crazy OU structure. Every week or so we get a spreadsheet of terminated users that comes from a different database, then we go through that excel sheet to disable the account, update their description, and move them to the disabled users OU for our Country.

So I'd like to semi automate this for myself, if going through a CSV or something or maybe Powershell would be better please by all means any help would be great.

So again, we: 1. Disable the User Account 2. Update the description usually something like "Termed on 10/31/2017 - JB" 3. Move the account to a specified OU.

Edit:I should also mention that we do get the employee ID numbers, which we use in AD under EmployeeNumber, SAM_Account_Name and email address in the generated spreadsheet.


r/usefulscripts • • Jun 27 '16

[PowerShell] New AD Users in Bulk from CSV with Password verification

29 Upvotes

I wrote this script a couple weeks ago. It will create users from a CSV file without having to store the password for each user in the CSV or the script.

You can download it here.

It will prompt you to enter and confirm a password. If the password is blank or they do not match the scripts dies.

The one to do is to check the entered password against the domain password complexity rules before it executes. I'm guessing I could use some sort of Regex pattern to check this, I just haven't gotten around to figuring it out. As it is now, if you enter a simple password it creates the users disabled.


r/usefulscripts • • May 22 '15

[POWERSHELL] Collect-ServerInfo.ps1, a Windows Server inventory script

Thumbnail
paulcunningham.me
29 Upvotes

r/usefulscripts • • Aug 30 '23

Automatically Convert HEIC To PNG Files

28 Upvotes

Maybe someone else is tired of the headache of copying, converting and resizing .HEIC files from their iPhone like I am.

With the help of ImageMagick and ChatGPT, I created a couple scripts that, when you drag and drop your .HEIC files to your local C:\Images folder, they will be converted to png and resized (and the original files get deleted from C:\Images). You can also make a Scheduled Task to run one of the scripts upon logon that will monitor the C:\Images folder and kick off the convert and resize automagically. I hope someone finds it helpful:

https://github.com/Jump-Ace/HEIC2PNG

Jerome


r/usefulscripts • • Mar 08 '21

Secure HTTPS DSC Pull Server w/ SQL Backend using a Group Manager Service Account (gMSA)

28 Upvotes

I couldn't find a tutorial that included the gMSA piece, so I made one. It's a bit -verbose so I put timestamps in the video description. I'm interested to hear if anyone knows of a less hacky way to set the gMSA on the app pool as part of the DSC config.

https://youtu.be/d2IXnrqY48Q


r/usefulscripts • • Jan 03 '21

[PowerShell] Creating Office 365 Migration Diagram with PowerShell

28 Upvotes

Here's a short story on how to create an Office 365 diagram using just PowerShell and nothing else.

The following diagram can be generated with just 20 lines of code as soon as you install the PowerShell module called PSWriteHTML.

Sources as always on GitHub: https://github.com/EvotecIT/PSWriteHTML


r/usefulscripts • • Dec 19 '17

A few Python scripts that you might find userful

Thumbnail
github.com
28 Upvotes

r/usefulscripts • • Mar 13 '17

[POWERSHELL] Jenkins, Powershell, AWS and Cloudflare Automated Deployment. (Part3 Cloudflare)

28 Upvotes

More updates on the Github. That contains the Jenkins template (the zip file). as well as the code for both scripts.

The blog lays out what you need to do and the options. Found here

This is the final in this series so I figured I'd post it in case anyone is watching it. I updated the code some more so if your using the version from the last post I changed it so you have an option to not overwrite the IP in cloudflare just because a new instance was created with the same name as the last.

Thanks.


r/usefulscripts • • Oct 04 '16

[Python] Ping list of servers and make spreadsheet of results

28 Upvotes

Requirements: python openpyxl library

Code: http://pastebin.com/YJkb9EjK

Screenshot: http://imgur.com/a/FFXsX

Have all your server names in a text file and specify in the file name in the script (right now it's file.txt)