Guy Leech

Guy Leech

@guyrleech.bsky.social

PowerShell nut. Dog owner. Grandfather

1.2K followers233 following866 posts

Did you know that when you've pressed Alt + tab on Windows 11, you can then use the cursor keys to move quicker, eg down, to the tab you want whilst still pressing Alt & release Alt? Similarly, press Windows + Tab & use cursor keys to navigate around & select via window thumbnail then press Enter

Got a #PowerShell array of objects with already sorted timestamps where you want to reverse the order? Eg I got logs from @Googlecloud but was most recent 1st & I wanted oldest first & rather than sort on the datestamp, I just reversed the array with [array]::Reverse( $yourArray )

Also helps when you want to reverse the chronological order but the dates aren't (yet) in a datetime time, eg returned as text so would need casting/converting to datetime to be able to sort correctly in PowerShell

Is #dedup for NTFS on Server 2025 supported by #Microsoft for #FSlogix or not? Most AI says not but fails to give a definitive reference. Was enabled & working on a system I inherited BUT there was also corruption on that volume. Surely should be ok as a file system feature invisible to FSlogix?

Well this is something that I have never seen before today in #PowerShell 5.1 & the lines causing it have been in my $profile for years. PowerShell.exe date is today - this could break a lot of scripts (as in cause them to pause f input)!! 😱

Anyone found a way to toggle the Do Not Disturb Notification setting in Windows 11? Found some stuff around setting registry values which didn't pan out & other stuff that P/Invoked WNF APIs but that failed too. Tried what I found in procmon but failed. Surely it must be possible?

Guy Leech reposted

He’s back. 👔 The man who started it all — @jsnover.com, Inventor of #PowerShell, will open #PSConfEU 2026 in #Wiesbaden with the keynote you don’t want to miss. 🎟️ Tickets now available → psconf.eu #Automation #IT #Germany #Europe

EUC folks with non-persistent desktops but using something like #FSlogix have you found a way to stop @OneDrive from taking ages (>50 minutes) to drop the (dehydrated) place holders into a new profile? Our sessions are generally <1 hour so cutting it fine + what if user needs a "late" file?

Here's a typical use case for me using -Outvariable in an interactive PowerShell command line where I'm searching for a file so I want visual output as it searches but I also want the results in a variable so I can access more properties later if I need them without searching again

Guy Leech reposted

Note that the default in secpol.msc says "Not Configured" but it's on by default so enable auditing but don't enable Success. I don't believe that these events are useful - they cause log overwrite of ones that are like process creation & termination

If you want to quickly figure out if & where a process is writing a logfile, create a filter (ctrl l) in @SysInternals procmon for your process(es) and also Category = Write & turn off registry & network capture in the toolbar

Any of you got experiences of packaging Adobe or AutoCAD apps into MSIX and delivering via App Attach? About to have a play myself but interested to know if others have tried. I think going App-V is probably not a sensible approach given its life expectancy.

TIL I've been using Microsoft products since 1980 when I wrote my first lines of BASIC code which was on a Commodore PET that my late (mainframe) COBOL coding father sometimes brought back from his office

New PowerShell script to find your geographically closest Azure location. Uses geo location so may not be accurate! Guess which of these I ran from a Windows 365/Cloud PC instance? 😂 Will prompt for login if not connected which may need tenant or subscription parameters github.com/guyrleech/Az...

PowerShell 5.1 gave: Move-Item : Cannot create a file when that file already exists. even with -Force. Was a permission error as existing file only had permission for SYSTEM & script running as admin.

Need the path to the user profile for the system account? (Get-CimInstance -ClassName win32_userprofile -filter "sid = 'S-1-5-18'").LocalPath Profiles for other special accounts also available that way

Guy Leech reposted