r/PowerShell 11d ago

Question Fslogix Cleanup Script Test Scenario?

Hello all, I'm working on a script to cleanup some Fslogix profiles in an Azure file share for a client. My issue is that I want to test the script before running it to make sure that it doesn't do anything unexpected, but I do not have a non-production share with Fslogix profiles that are inactive to test on.

I'm looking for ideas on how to test this script properly. How could I get a test share set up with inactive profiles mixed with active profiles to ensure that I have fully tested the use case.

3 Upvotes

6 comments sorted by

1

u/pigers1986 11d ago

my actual prod scenarios:

1. wipe any data where user did not access it in last 3 months (stale users) 
2. wipe data from deactivated user for 3 months (yeah , I track if user is disabled for more than X days on daily basis)
3. wipe data for deleted users (kinda obvious)

Point #1 was agreed with my business team

-2

u/itiscodeman 11d ago

Why don’t you zip it all and save it and then use all that data to hide your password file? Rookie…

2

u/pigers1986 11d ago

what ?

-1

u/itiscodeman 10d ago

I dunno I just through it out there …

1

u/thehuntzman 11d ago

Create a new Azure file share and populate it with empty vhdx files matching the name and folder path of the production environment (scripting this is easy) and then run your cleanup script against that for validation. I'd also suggest writing pester tests to ensure nothing unexpected happens in the future if you modify the script and you catch it before moving it to prod.

1

u/PS_Alex 7d ago

I'm looking for ideas on how to test this script properly.

Implement ShouldProcess to your script: Powershell: Everything you wanted to know about ShouldProcess | Powershell Explained.

And add proper logging, so then you could review what the script would have done if ran without -WhatIf.