r/PowerShell • • Jun 09 '25

Script Sharing 20+ Years of Google Photos, 100GB of Files, One PowerShell Script

141 Upvotes

I had posted this earlier, but wasn't satisfied with the contents of the body. What follows is the message I should have given to clearly explain a problem I was trying to solve. What follows is my story.

I recently downloaded 100 GB of media files from my Google Drive. Since the files dated back over twenty years, I had to use their Google Takeout service. It packaged all of my files into fifty separate 2 GB zipped files. It was a pain to download all of them, and the process worsened after unzipping them.

The folder structure is the zipped folder as the root. Under that is another individual folder for Takeout. The next subfolder is Google Photos. As you enter that folder, you'll find many folders organized by year. As you enter each folder, you'll find all the media file types that you've been storing over the years. Among them are dozens of JSON files. I initiated a manual process of sorting by file type, selecting all JSON files, deleting them, and then moving all the remaining files to a single folder for media storage.

While this manual process worked, I found that as I transitioned from one set of uncompressed folders to another and moved the files out, numerous duplicate name conflicts arose. I needed to automate the renaming of each file.

I'm no expert in PowerShell, but I've come to utilize AI to help create simple scripts that automate redundant administrative tasks. The first script I received help with was to traverse all subfolders and delete all JSON files recursively. That was easy.

Next, I went about renaming files. I wanted to use the Date and Time that the file was created. However, not all of my files had that information in their metadata, as shown by the file property details. After further investigation, I discovered a third-party command-line tool called ExifTool. Once I downloaded and configured that, I found that the metadata I wanted to look for was an attribute called DateTimeOriginal. However, I also discovered that many of my older files lacked that information and were effectively blank. So, I had to come up with a way to rename them without causing conflict. I asked AI to randomly generate an eight-character name using uppercase letters and numbers 0-9. For the majority of files, I used a standard naming convention of YYYY-MM-DD_HH-MM_HX.fileType. Obviously, that was for Year, Month, Hour, Minute, and two HEX characters, which I had randomly generated. I asked AI to help me set up this script to go through a folder and rename all media files recursively. It worked great.

As I worked through more file renaming and consolidating, I realized I needed another folder to store all subfolder media files, rename them, and then move them to a final media folder. That was to avoid constantly renaming files that were already renamed. Once all media files in the temporary folder have been renamed, the script moves them to the final media storage folder.

As I developed what was initially three scripts, I reached a point where I felt confident that they were working smoothly. I then asked AI to help stitch them all together and provide a GUI for all steps, including a progress window for each one, as well as a .CSV log file to document all changes. This part became an iterative exercise, as it required addressing numerous errors and warnings. Ultimately, it all came together. After multiple tests on the downloaded Google media, it appears to be an effective script. It may not be the most elegant, but I'm happy to share it with this community. This script works with any Windows folder structure and is not limited to just Google media file exports.

That holistic media move/rename/store script follows:

EDIT: I realized after the fact that I also wanted to log file size in its proper format. So, I updated the script to capture that information for the CVS log as well. That component is in this updated script below.

EDIT 2: I've improved the PS interface, updating it with each process and data output, as well as enhancing the progress bar for each task to display (x/y).

# ============================================
# MASTER MEDIA FILE ORGANIZATION SCRIPT
# ============================================

# This script requires that ExifTool by Phil Harvey is on your computer and it's referenced in your enviornmental variables System PATH.
# You can download ExifTool at: https://exiftool.org/
# See https://exiftool.org/install.html for more installation instructions.
# Once installed, test it by running PowerShell and typing exiftool, and hit Enter. If it runs, you're golden!

Add-Type -AssemblyName System.Windows.Forms

function Show-ProgressWindow {
    param (
        [string]$Title,
        [string]$TaskName,
        [int]$Total
    )

    $form = New-Object System.Windows.Forms.Form
    $form.Text = $Title
    $form.Width = 400
    $form.Height = 100
    $form.StartPosition = "CenterScreen"

    $label = New-Object System.Windows.Forms.Label
    $label.Text = "$TaskName (0/$Total)"
    $label.AutoSize = $true
    $label.Top = 10
    $label.Left = 10
    $form.Controls.Add($label)

    $progressBar = New-Object System.Windows.Forms.ProgressBar
    $progressBar.Minimum = 0
    $progressBar.Maximum = $Total
    $progressBar.Value = 0
    $progressBar.Width = 360
    $progressBar.Height = 20
    $progressBar.Left = 10
    $progressBar.Top = 30
    $form.Controls.Add($progressBar)

    $form.Show()
    return @{ Form = $form; ProgressBar = $progressBar; Label = $label }
}

function Write-Teal($text) {
    Write-Host $text -ForegroundColor Cyan
}
function Write-Yellow($text) {
    Write-Host $text -ForegroundColor Yellow
}
function Write-Green($text) {
    Write-Host $text -ForegroundColor Green
}
function Write-White($text) {
    Write-Host $text -ForegroundColor White
}

# Banner
Write-Green "=============================="
Write-Green "Media File Organization Script"
Write-Green "=============================="

# Folder selections
Add-Type -AssemblyName System.Windows.Forms
$folderBrowser = New-Object System.Windows.Forms.FolderBrowserDialog

$folderBrowser.Description = "Select the folder where your original media files are located"
$null = $folderBrowser.ShowDialog()
$sourcePath = $folderBrowser.SelectedPath

$folderBrowser.Description = "Select the folder to stage files for renaming"
$null = $folderBrowser.ShowDialog()
$stagingPath = $folderBrowser.SelectedPath

$folderBrowser.Description = "Select the final folder to store renamed files"
$null = $folderBrowser.ShowDialog()
$finalPath = $folderBrowser.SelectedPath

foreach ($path in @($sourcePath, $stagingPath, $finalPath)) {
    if (-not (Test-Path $path)) {
        New-Item -ItemType Directory -Path $path | Out-Null
    }
}

# Step 1: Delete JSON Files
$jsonFiles = Get-ChildItem -Path $sourcePath -Recurse -Filter *.json
if ($jsonFiles.Count -gt 0) {
    $progress = Show-ProgressWindow -Title "Deleting JSON Files" -TaskName "Processing" -Total $jsonFiles.Count
    $count = 0
    foreach ($file in $jsonFiles) {
        Remove-Item -Path $file.FullName -Force
        $count++
        $progress.ProgressBar.Value = $count
        $progress.Label.Text = "Processing ($count/$($jsonFiles.Count))"
        [System.Windows.Forms.Application]::DoEvents()
    }
    Start-Sleep -Milliseconds 500
    $progress.Form.Close()
}
Write-Host ""
Write-White "Processed $($jsonFiles.Count) JSON files.`n"

# Step 2: Move to Staging
Write-Yellow "Step 1: Moving files to staging folder..."
$mediaExtensions = @(
    "*.jpg", "*.jpeg", "*.png", "*.gif", "*.bmp", "*.tif", "*.tiff", "*.webp",
    "*.heic", "*.raw", "*.cr2", "*.nef", "*.orf", "*.arw", "*.dng", "*.rw2", "*.pef", "*.sr2",
    "*.mp4", "*.mov", "*.avi", "*.mkv", "*.wmv", "*.flv", "*.3gp", "*.webm",
    "*.mts", "*.m2ts", "*.ts", "*.vob", "*.mpg", "*.mpeg"
)
$filesToMove = @()
foreach ($ext in $mediaExtensions) {
    $filesToMove += Get-ChildItem -Path $sourcePath -Filter $ext -Recurse
}
$progress = Show-ProgressWindow -Title "Moving Files" -TaskName "Processing" -Total $filesToMove.Count
$count = 0
foreach ($file in $filesToMove) {
    Move-Item -Path $file.FullName -Destination (Join-Path $stagingPath $file.Name) -Force
    $count++
    $progress.ProgressBar.Value = $count
    $progress.Label.Text = "Processing ($count/$($filesToMove.Count))"
    [System.Windows.Forms.Application]::DoEvents()
}
Start-Sleep -Milliseconds 500
$progress.Form.Close()
Write-White "Successfully moved $count files.`n"

# Step 3: Rename Files
Write-Yellow "Step 2: Renaming files..."
function Get-RandomName {
    $chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
    -join ((1..8) | ForEach-Object { $chars[(Get-Random -Minimum 0 -Maximum $chars.Length)] })
}
function Get-ReadableFileSize($size) {
    if ($size -ge 1GB) { return "{0:N2} GB" -f ($size / 1GB) }
    elseif ($size -ge 1MB) { return "{0:N2} MB" -f ($size / 1MB) }
    else { return "{0:N2} KB" -f ($size / 1KB) }
}

$timestampTracker = @{}
$global:LogOutput = @()
$global:logPrefix = (Get-Date -Format "yyyy-MM-dd_HH-mm")
$renameTargets = @()
foreach ($ext in $mediaExtensions) {
    $renameTargets += Get-ChildItem -Path $stagingPath -Filter $ext -Recurse
}
$progress = Show-ProgressWindow -Title "Renaming Files" -TaskName "Processing" -Total $renameTargets.Count
$count = 0
$metadataCount = 0
$randomCount = 0
foreach ($file in $renameTargets) {
    try {
        $ext = $file.Extension.ToLower()
        $dateRaw = & exiftool -q -q -DateTimeOriginal -s3 "$($file.FullName)"
        $fileSizeReadable = Get-ReadableFileSize $file.Length
        $newName = ""

        if ($dateRaw) {
            $dt = [datetime]::ParseExact($dateRaw, "yyyy:MM:dd HH:mm:ss", $null)
            $timestampKey = $dt.ToString("yyyy-MM-dd_HH-mm")
            $hexSuffix = "{0:X2}" -f (Get-Random -Minimum 0 -Maximum 256)
            $newName = "$timestampKey" + "_$hexSuffix$ext"
            $metadataCount++
        } else {
            $newName = "$(Get-RandomName)$ext"
            $randomCount++
        }

        $collisionPath = Join-Path $file.DirectoryName $newName
        while (Test-Path $collisionPath) {
            $randomTag = Get-Random -Minimum 1000 -Maximum 9999
            $newName = $newName.Replace($ext, "_$randomTag$ext")
            $collisionPath = Join-Path $file.DirectoryName $newName
        }

        Rename-Item -Path $file.FullName -NewName $newName -ErrorAction Stop
        $global:LogOutput += [PSCustomObject]@{
            Timestamp = (Get-Date -Format "yyyy-MM-dd HH:mm:ss")
            Action = "Renamed"
            OriginalName = $file.Name
            NewName = $newName
            OriginalFilePath = $sourcePath
            FinalFilePath = $finalPath
            FileSize = $fileSizeReadable
            RenameType = if ($dateRaw) { "Metadata" } else { "Random" }
        }
    } catch {
        continue
    }

    $count++
    $progress.ProgressBar.Value = $count
    $progress.Label.Text = "Processing ($count/$($renameTargets.Count))"
    [System.Windows.Forms.Application]::DoEvents()
}
Start-Sleep -Milliseconds 500
$progress.Form.Close()
Write-White "Renamed $metadataCount files using metadata, $randomCount files with random names.`n"

# Step 4: Final Move
Write-Yellow "Step 3: Moving to final destination..."
$finalFiles = @()
foreach ($ext in $mediaExtensions) {
    $finalFiles += Get-ChildItem -Path $stagingPath -Filter $ext -Recurse
}
$progress = Show-ProgressWindow -Title "Moving Files" -TaskName "Processing" -Total $finalFiles.Count
$count = 0
foreach ($file in $finalFiles) {
    Move-Item -Path $file.FullName -Destination (Join-Path $finalPath $file.Name) -Force
    $count++
    $progress.ProgressBar.Value = $count
    $progress.Label.Text = "Processing ($count/$($finalFiles.Count))"
    [System.Windows.Forms.Application]::DoEvents()
}
Start-Sleep -Milliseconds 500
$progress.Form.Close()
Write-White "Successfully moved $count files.`n"

# Save log
$logCsvPath = Join-Path $finalPath ($global:logPrefix + "_LOG.csv")
$global:LogOutput |
    Select-Object Timestamp, Action, OriginalName, NewName, OriginalFilePath, FinalFilePath, FileSize, RenameType |
    Export-Csv -Path $logCsvPath -NoTypeInformation -Encoding UTF8

# Summary Output
Write-Green "======= PROCESSING SUMMARY ========"
Write-Teal "Files renamed using metadata : $metadataCount"
Write-Teal "Files renamed with random ID : $randomCount"
Write-Teal "Total files renamed          : $(($metadataCount + $randomCount))"
Write-Teal "Files moved to final folder  : $count"
Write-Green "==================================="
Write-Teal "`nDetailed log saved to: $logCsvPath"
Write-Green "`nProcessing completed successfully!`n"

r/PowerShell • • May 18 '21

Information Network Troubleshooting w/ PowerShell

Thumbnail
youtu.be
141 Upvotes

r/PowerShell • • Nov 19 '20

PowerShell Splatting: What is it and How Does it Work?

141 Upvotes

Hey guys,

Adam Listek just wrote a shiny new blog post you may enjoy.

"PowerShell Splatting: What is it and How Does it Work?"

Summary: PowerShell splatting is the strange phrase that can turn your script from a mess of code to a nicely structured work of art. Learn how in this tutorial!

https://adamtheautomator.com/powershell-splatting-what-is-it-and-how-does-it-work/


r/PowerShell • • Apr 22 '20

News Windows Terminal Preview v0.11 Release | Windows Command Line

Thumbnail
devblogs.microsoft.com
141 Upvotes

r/PowerShell • • Jan 18 '19

I made a thing (Powershell Universal Dashboard)

141 Upvotes

Hi all,

Sometimes getting the idea is half the work. So I’m posting this for inspiration, and, frankly, to toot my own horn!

https://forums.universaldashboard.io/t/dashboard-displaying-information-on-consultants-and-employees/281

Monthly, at least, HR had to go through the process of gathering information on consultants, by going to Supply Chain Management and have them scrape data off contracts. That’s all lot of of the same work again and again.

So they realized that a lot of that information where already present “digitally” in our AD: contract expirations were reflected in account expiration, place of work, department and who they report to as well.

With some simple scripts to gather and treat the data from AD, and the magic that is Universal Dashboard. I was able to make a dashboard that show consultants distribution in the company, both organizational and geographical. The planned decline in consultants and of course what assets they are registered owner of (assets details are stored in a database I coincidentally made for fun recently).

Most of the stuff I do with powershell goes unnoticed, but this is the first time I’ve ever had management look at something I made. Pretty great feeling!

Enjoy your weekend!


r/PowerShell • • Jun 23 '18

Create an Interactive HTML Report for Office 365 with PowerShell

Thumbnail
thelazyadministrator.com
141 Upvotes

r/PowerShell • • Nov 22 '19

News AWS Tools for PowerShell is now generally available with version 4.0

Thumbnail
aws.amazon.com
140 Upvotes

r/PowerShell • • Jul 26 '24

Script Sharing Leveling up PowerShell Profile

139 Upvotes

Hello PowerShell Enthusiasts 👋,

Many people treat their shell as just a script runner, but as someone who loves PowerShell and runs it on all their machines (Windows, Mac, and Linux), I wanted to share all the amazing things you can do with it beyond just running scripts.

https://blog.belibug.com/post/ps-profile-01/

My latest blog post has several not-so-common ways to elevate your PowerShell experience for beginners. It covers:

  • Personalizing your prompt

  • Mastering aliases and modules

  • Leveraging tab completion

  • Enhancing your shell with modules

  • ...and much more!

This list is just the tip of the iceberg! If you have any other PowerShell tricks or tips that I haven't covered, or there is better way to do it, let me know – I'm always eager to learn and will update content accordingly 😊 Happy weekend!

PS: Don't let the length scare you off! Use the handy TOC in the blog to jump around to the juicy bits that interest you most. Happy reading! 🤓


r/PowerShell • • Mar 14 '22

Script Sharing Introducing Azure Administrator - A new (mostly) open-source GUI for all your Azure help desk needs!

139 Upvotes

First and foremost, a heartfelt and sincere thank you! to all the folks that have helped out in this community along my journey.

Before I throw a bunch of info at you guys/gals, I'd like to preface with this: No, that is not a clickbait title. I say mostly open source because I have provided all my source code here, but I created the whole project using Sapien's PowerShell Studio; so you can see what's there, but you'll need to find yourself a copy of PowerShell Studio to edit it. No worries though, I have a generic MSI you can use!

I've been working on this project for quite a while trying to get things just right. I almost had it complete, until Microsoft announced they were deprecating the AzureAD PS module. So I did what any good sysadmin would do... Sat down and taught myself APIs!

And this application is the end result of my learning/training! I leverage PowerShell and the Microsoft Graph API to get it done. This app does all your most basic help desk tech needs, primarily user and group management (with more to come at a later date!), including: New User, Edit User, Terminate User, Add User to Group, Assign License, and more.

All of this is free to the world, free to everybody - I believe in the power of sharing knowledge. :) All I ask is for any feedback/bugs you guys might find along the way. As of right now, there's only one known major bug: When assigning licenses, if you try to do multiple there's a possibility it will fail, due to weird rate limiting by Graph. Currently investigating.

The only pre-requisite to deployment is that you'll need to create a registered application in AAD and enter in the AppID/ClientID on first program run when prompted. You can find all the steps on how to do that here, courtesy of Microsoft.

Edit to add: I totally forgot! Every single function I used in this application is available here as well, complete with (some) documentation!

ETA2: Guys, I can't directly link screenshots here because my post keeps getting auto-removed. Please see one of my other posts for links to the screenshots.


r/PowerShell • • May 14 '19

Information Paul on the PowerShell Team just published a new RFC to enable `foreach -parallel` in PowerShell 7 (outside of workflows)

Thumbnail
twitter.com
139 Upvotes

r/PowerShell • • Dec 29 '17

Just sharing some of my PowerShell scripts that you guys may find useful.

139 Upvotes

Linky-poo: https://github.com/AndrewEllis93/PowerShell-Scripts

  • ADHealthCheck: This one is largely based on a script by Vikas Sukhija, who is credited in the body. I really only made some minor edits to his. Mine just adds a column that shows the last replication time and only emails if there is an unhealthy status or failure to cut down on email spam.

  • Disable-InactiveADAccounts: Make sure you read through the comments (as with all of these scripts). It just finds the last logon for all AD accounts and disables any that have been inactive for X number of days (depending on what threshold you set). The difference with this script is that it gets the most accurate last logon available by comparing the results from all domain controllers. By default the lastlogontimestamp is only replicated every 14 days minus a random percentage of 5. This makes it much more accurate, but also it is a very slow script for reasons I can't quite figure out. But it works. It also supports an exclusion AD group that you can put things like service accounts in to prevent them from being disabled. It will also email a report to the specified email addresses.

  • Discover-DriveSpace: This one gets all your servers in AD and dumps the drives with sizes and remaining free space to a CSV (drivespace.csv). It also export some other files - pingable.txt, pingfail.txt, and servers.csv. Those should be self-explanatory.

  • Discover-Shares: This one is a discovery function to find all Windows shares on the domain. Useful for acquisitions.

  • Dump-GPOs: This one exports all of your GPOs' HTML reports, a CSV detailing all the GPO links, and a txt list of all the GPOs.

  • Enumerate-Access: This function will spit back all of the permissions of a specified folder, recursively. You can choose to return inherited permissions or not. I wrote this specifically to show each and every ACL entry on a separate line. It's really useful for finding where a group or user is being used in NTFS ACLs. This helped us get rid of mail-enabled security groups by discovering each place that they were being used in NTFS ACLs so we could replace them. In most cases you won't want it to return inherited permissions (it doesn't by default) so you don't get a TON of redundant output, just the explicit ACL entries. It will generate a lot of disk activity on the target server because it scans the entire file system of the folder specified. At one point I actually combined this with the Find-Shares script to enumerate the ACLs on every file share we had. It took forever, needless to say, but helped a lot with weeding out old AD groups :)

  • Move Disabled: This moves disabled computers too. It rounds up disabled accounts and ages them through different OUs (0-30 days, 30-180 days, over 180 days).

  • Move-StaleUserFolders: This script will scan all first-level sub-folders of the specified BasePath to find the most recent LastWriteTime in each one (recursively). This is really intended for user folders. It will move stale folders to the directory specified. You can modify this to just report instead, read the description up top.

  • Restart-DFSRAndEnableAutoRecovery: Nice and short and simple. It restarts the DFSR service on all domain controllers (I schedule this to run nightly. This isn't really necessary but I have found it to prevent some misc issues that crop up once in a blue moon) and enables DFSR auto-recovery, which for whatever reason is disabled on domain controllers by default.

  • Send-PasswordNotices: This sends password expiration notice emails to users at 1,2,3,7, and 14 days. Supports an AD exclusion group.

As with all scripts you find on the internet, please carefully read through them and understand what they do before blindly running them in your environment. Always run in a test environment first. I put a fair bit of comments in these to try and make them easier to understand. Some have warnings at the top so please read those. Some also have "-ReportOnly" arguments that you can add to only get the output of the actions it would take.


r/PowerShell • • Aug 19 '16

Curl author asks Microsoft to remove 'curl' and 'wget' aliases from PowerShell

Thumbnail
github.com
139 Upvotes

r/PowerShell • • Jun 11 '26

Script Sharing Made a PowerShell script that strips telemetry, ads, and forced AI out of Windows 11 (and nothing else)

138 Upvotes

I switched back to Windows from Linux recently and the amount of telemetry, ad "suggestions," and forced Copilot/Recall stuff drove me up the wall. So I put the fixes I kept applying by hand into one script.

It does three things and nothing more:

Privacy / telemetry

  • Disables the DiagTrack "Connected User Experiences and Telemetry" service + sets telemetry policy to 0

  • Kills the advertising ID, tailored experiences, app-launch tracking, and activity history

  • Turns off the Start/Settings/lock-screen "suggested content" ads and the auto-installer that drops promo apps (Candy Crush etc.) onto fresh installs

Forced AI

  • Turns off Windows Copilot, Recall, and Click to Do

  • Removes Bing/Cortana web results from Start search

Obvious bloat

  • Removes a short list of preinstalled junk apps (Bing News/Weather, Solitaire, Clipchamp, Get Help, Feedback Hub, Maps, People, Office Hub, the new Outlook, Power Automate, Dev Home, Cortana). The list is right at the top of the script, edit it to taste.

Limitations / what to know:

  • Windows 10/11 only. On older builds the AI/Recall keys just do nothing (harmless).

  • Works best on Pro/Enterprise. On Home, Windows clamps telemetry to "Required" instead of fully off, and may ignore the consumer-features policy. Everything else still applies.

  • It uses the official Windows toggles/policies — it's not a firewall or hosts-file block. If you want network-level telemetry blocking on top, pair it with something like a Pi-hole or a hosts list.

  • Some changes need a sign-out or reboot to fully kick in (taskbar/search/Copilot button).

  • App removal is current-user only and every app is reinstallable from the Store, so nothing's permanent.

  • Reverting: re-enable the two services (DiagTrack, dmwappushservice) and delete the keys it set. I might add an -Undo flag later.

What it does NOT do: it doesn't touch your installed programs, files, games, drivers, or your language/region/keyboard. (I'm Danish — it leaves æ ø å completely alone. That was a hard requirement for me.)

I'm not piping anything into iex for you — copy the script straight from the repo, read it, then run it yourself in an admin PowerShell. It's one file, plain PowerShell, no binaries, no network calls.

Repo: https://github.com/oscarmeldgaard/Windows-Privacy-Debloat

Read every line before you run it. Not trying to reinvent O&O ShutUp10 or Win11Debloat — this is just the lean subset I actually wanted, in a file you can read in two minutes. Feedback and PRs welcome.


r/PowerShell • • Mar 27 '23

Script Sharing I just released PSSnow - A module for interacting with ServiceNow REST APIs

138 Upvotes

In the past 3 weeks I've put together a PowerShell module for interacting with the ServiceNow REST API in an intuitive user friendly way.

Hopefully this comes in handy for people and allows you to write cleaner code whilst interacting with ServiceNow!

Check out my demo video here (20mins - it covers alot of features!) : https://youtu.be/UfT_pz82bn8

Powershell Gallery: https://www.powershellgallery.com/packages/PSSnow

Some of the key features:

  • Handles OAuth auto token renewal

  • Pagination is handled automatically (but can still be manually controlled)

  • Provides generic 'template' functions to interact with all tables

  • Provides table specific functions with auto-complete

  • Batch API integration is as easy as wrapping your existing code with a scriptblock

  • Attachments can be passed through without the need to interact with the filesystem

  • Service Catalog requests and incidents can be automated

  • Filters/Queries can be copied directly from ServiceNow and used in table GET commands

  • Dot walking across tables is possible

  • Get the variables for a specified RITM (values for all fields logged in a catalog form)

Github Project: https://github.com/insomniacc/PSSnow

Function Builder Demo: https://youtu.be/-KzV9Ao9Hsc


r/PowerShell • • Apr 23 '22

What new acquired PowerShell concept/understanding significantly improved the quality/performance of your scripts that inspired you to go back and integrate it into some of your old scripts?

138 Upvotes

r/PowerShell • • Dec 18 '21

Here is a Simple Script to detect for potential Log4J Vulnerabilities. I was scanning hashes earlier in the week but that proved unreliable so this just looks for known versions and unpacks to check for the class. Its been quick and reliable so far, just sharing as another option - good luck all!

Thumbnail
github.com
138 Upvotes

r/PowerShell • • Feb 28 '21

How to create a loaner laptop checkout/checkout system in Powershell

Thumbnail
smarthomepursuits.com
138 Upvotes

r/PowerShell • • Jan 26 '21

PowerShell Remoting: The Ultimate Guide

138 Upvotes

Hey guys,

u/ /r/ps_tyler just wrote a shiny new blog post you may enjoy.

"PowerShell Remoting: The Ultimate Guide"

Summary: How does PowerShell Remoting (PSRemoting) work? What authentication options are available? Learn this and more in this ultimate guide.

https://adamtheautomator.com/psremoting/


r/PowerShell • • Oct 22 '19

Thanks to this subreddit, I finally finished my first ever GUI project that clones VMs from templates!

138 Upvotes

This is the initial screen.

This is the GUI after everything is filled out.

Basically, it takes a template and clones from it multiple times.

Some features I like about it:

  • It tells you how much free storage you have in the selected datastore.

  • It tells you how much storage will be left in the DS after the cloning process is done.

  • It allows picking a folder to clone to by looking it up using the "find folder button".

  • If you environment is like ours, where you clone Linux VMs to Linux datastores, and Win VMs to seperate datastores, then clicking "Fetch" in the OS menu populates the other fields based on that selection. Same for the customization templates.

  • If you name your VM "RedditTest01" and choose 3 VMs to clone, then each new VM will have a new name by adding 1 to the number, so it will be RedditTest02, RedditTest03 and so on..

It took me some time to finish this, as I don't really know PS, but it was fun and I actually got to use it in my job!

Thank you so much for the help, and special thanks to https://poshgui.com. They're the best :)

Edit:

Here's the github page


r/PowerShell • • Jun 04 '23

Information Want to learn how to work with APIs?

137 Upvotes

Hey Powershell peeps!

You learn far more by doing than by just listening.... Join Devin Rich this Wednesday evening as he takes you on a hands-on, guided tour of working with APIs in PowerShell.

All skill levels welcome! Time and connect info are in the meeting notes... follow link for details.

https://www.meetup.com/research-triangle-powershell-users-group/events/293877891/


r/PowerShell • • Jul 26 '18

Windows Admin Center (formerly Project Honolulu) Functions on GitHub

137 Upvotes

Windows Admin Center is a nice Web-based GUI that you can use to manage your servers in your Windows environment. The majority of information displayed on every page comes from PowerShell functions. You can view those PowerShell functions by clicking the the PowerShell icon in the top-right corner of any given page that you're on.

I grabbed all of those PowerShell Functions and placed them in a public GitHub repo so that folks can use them in other contexts (which is explicitly allowed by Microsoft).

https://github.com/pldmgg/WinAdminCenterPS

There are a lot of really useful functions as well as some...questionable ones. But overall, it's a really good collection.

Hope this can help some folks out!

Maybe Microsoft can publish all of these in their own GitHub repo so that they can be kept up to date :)


r/PowerShell • • Apr 14 '26

PowerShell MSI installer deprecated on Windows in favor of MSIX

136 Upvotes

r/PowerShell • • Apr 15 '21

Question What do you guys do to setup Visual Studio Code for PowerShell?

136 Upvotes

Hi everyone! I've been fooling around with Visual Studio Code and the PowerShell extension and wanted to see how everyone else configured theirs. Some drawbacks I've noticed is that Intellisense won't pickup some imported module arguments (looking at you MSGraph) within the scripting pane. What's your experience? Have any tips on making it a full replacement for PowerShell ISE? Thanks!

Edit: Here's an example of my settings.json:

"editor.defaultFormatter": "ms-vscode.powershell",
"editor.tabCompletion": "on",
"files.autoSave": "off",
"workbench.iconTheme": "vs-seti",
"files.defaultLanguage": "powershell",
"powershell.integratedConsole.focusConsoleOnExecute": false,
"powershell.integratedConsole.showOnStartup": false,
"editor.renderWhitespace": "all",
"editor.renderControlCharacters": true,
"files.trimTrailingWhitespace": true,
"files.encoding": "utf8bom",
"files.autoGuessEncoding": true,
"terminal.integrated.shell.windows": "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe"

I set the integrated shell this way since I want to respond to modern authentication requests.

Can you guys think of anything else I should add?


r/PowerShell • • Apr 04 '21

Script Sharing CI CD for PowerShell scripts in Active Directory environments

135 Upvotes

For anyone who is looking for simple solution to:

  • automate whole scripting content life cycle (validation, distribution, customization, deletion)

  • easily share functions with your colleagues

  • generate modules (from ps1 scripts)

  • unify your PowerShell environment

  • have global PowerShell variables that you can use in any function or script

  • have all code in your environment in one place

  • check your code before commiting it (syntax errors, best practices, compatibility, custom checks, ...)

  • enforce formatting etc through VSC workspace settings

  • sign your PowerShell files

  • distribute any code content to any client and to any location in your AD (or AAD) i.e. can be used for storing startup GPO scripts, SCCM install script, you name it

  • automatically create sched. tasks

  • ...

Other useful information:

  • no paid tools needed

  • installer included (written in PowerShell of course 😁)

  • incredibly simple to use

  • built on top of GIT (no GIT knowledge needed)

  • written completely in PowerShell (i.e. easy to customize)

  • idiot-proof (it won't let you commit changes in your functions / global variables that would break some dependent code)

  • there is function (Refresh-Console) to import new functions/variables to existing PS console

  • PS console title shows how far behind is such console in number of commits

  • possibility to distribute chosen content to AAD joined clients / separate git repository (not yet published)

If you are interested, please check out my GitHub repository or use case examples.

If you want to test features of this solution in safe manner in under 5 minutes, check this out.

If you prefer watching video, you can check these short videos with some features overview (new function, new variable, script validations) or little longer introduction video (sorry for my english :D)

Btw I will be grateful for any feedback (even negative) or feature requests :-)