[Skip to main content]

Home icon
WELCOME!
Steven Schiavone
Digital Forensics & Cybersecurity
Email icon
E-Mail
Home Work Pursuits UNIVAC Skills Education Links Blog Contact
Welcome to my home on the World Wide Web!  *  Digital Forensics & Cybersecurity Professional  *  Proud Eagle Scout  *  Pace University M.S. Cybersecurity

<< Back to Blog

A command to take charge of a windows directory, children, and subfolders 2026-10-02
[command] [windows] [ownership] [permissions]
if(!(whoami /groups|sls S-1-16-12288)){'Need Admin';break};$p='C:\Users\sschiavone';$m=Get-WindowsImage -Mounted|?{$_.Path -eq $p};if($m -and "$($m.MountStatus)" -ne 'Ok'){"MOUNT $($m.MountStatus) - dism /Unmount-Image /MountDir:$p /Discard; dism /Cleanup-Mountpoints";break};$A='*S-1-5-32-544';takeown /f $p /r /d y /a /skipsl|?{$_-match'denied|Error'};icacls $p /setowner $A /t /l /c /q;icacls $p /reset /t /l /c /q;icacls $p /grant "${A}:(OI)(CI)F" /t /l /c /q;'owned'

<< Back to Blog


Home | Work | Pursuits | UNIVAC | Skills | Education | Links | Blog | Contact | Site Map
(c) 2026 Steven Schiavone