New
#1
Attempting to set hidden attribute to start menu folders via cmd
Ok, so I've been working on my unattended install and I am hitting a wall. I currently am using classic shell start menu to replace the original and I want to set the default start menu folders to hidden for two reasons. First reason being that I already have links for each of these located in classic start menu and don't need a second set sitting in my programs folder. Second reason, if I delete them(which doesn't work either), windows updates like to replace a few of these every now and then.
Here is what I'm attempting to do via .bat file:
I verified that takeown and icacls are returning successfully, but the ONLY folder this works on is the Maintenance folder from both the programdata and appdata locations. The rest of the folders not only persist, but if I try to delete them via explorer I receive a pop up saying I need admin access, click ok and it deletes. So obviously something is preventing or retaking ownership of the folders??Code:takeown /f "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Maintenance" /r /d y > NUL 2>&1 icacls "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Maintenance" /grant administrators:F /t > NUL 2>&1 takeown /f "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Windows Accessories" /r /d y > NUL 2>&1 icacls "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Windows Accessories" /grant administrators:F /t > NUL 2>&1 takeown /f "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Windows Administrative Tools" /r /d y > NUL 2>&1 icacls "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Windows Administrative Tools" /grant administrators:F /t > NUL 2>&1 takeown /f "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Windows Ease of Access" /r /d y > NUL 2>&1 icacls "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Windows Ease of Access" /grant administrators:F /t > NUL 2>&1 takeown /f "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Windows System" /r /d y > NUL 2>&1 icacls "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Windows System" /grant administrators:F /t > NUL 2>&1 attrib +H "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Maintenance" > NUL 2>&1 attrib +H "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Windows Accessories" > NUL 2>&1 attrib +H "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Windows Administrative Tools" > NUL 2>&1 attrib +H "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Windows Ease of Access" > NUL 2>&1 attrib +H "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Windows System" > NUL 2>&1 takeown /f "%appdata%\Microsoft\Windows\Start Menu\Programs\Maintenance" /r /d y > NUL 2>&1 icacls "%appdata%\Microsoft\Windows\Start Menu\Programs\Maintenance" /grant administrators:F /t > NUL 2>&1 takeown /f "%appdata%\Microsoft\Windows\Start Menu\Programs\Windows Accessories" /r /d y > NUL 2>&1 icacls "%appdata%\Microsoft\Windows\Start Menu\Programs\Windows Accessories" /grant administrators:F /t > NUL 2>&1 takeown /f "%appdata%\Microsoft\Windows\Start Menu\Programs\Windows Administrative Tools" /r /d y > NUL 2>&1 icacls "%appdata%\Microsoft\Windows\Start Menu\Programs\Windows Administrative Tools" /grant administrators:F /t > NUL 2>&1 takeown /f "%appdata%\Microsoft\Windows\Start Menu\Programs\Windows Ease of Access" /r /d y > NUL 2>&1 icacls "%appdata%\Microsoft\Windows\Start Menu\Programs\Windows Ease of Access" /grant administrators:F /t > NUL 2>&1 takeown /f "%appdata%\Microsoft\Windows\Start Menu\Programs\Windows PowerShell" /r /d y > NUL 2>&1 icacls "%appdata%\Microsoft\Windows\Start Menu\Programs\Windows PowerShell" /grant administrators:F /t > NUL 2>&1 takeown /f "%appdata%\Microsoft\Windows\Start Menu\Programs\Windows System" /r /d y > NUL 2>&1 icacls "%appdata%\Microsoft\Windows\Start Menu\Programs\Windows System" /grant administrators:F /t > NUL 2>&1 attrib +H "%appdata%\Microsoft\Windows\Start Menu\Programs\Maintenance" > NUL 2>&1 attrib +H "%appdata%\Microsoft\Windows\Start Menu\Programs\Windows Accessories" > NUL 2>&1 attrib +H "%appdata%\Microsoft\Windows\Start Menu\Programs\Windows Administrative Tools" > NUL 2>&1 attrib +H "%appdata%\Microsoft\Windows\Start Menu\Programs\Windows Ease of Access" > NUL 2>&1 attrib +H "%appdata%\Microsoft\Windows\Start Menu\Programs\Windows PowerShell" > NUL 2>&1 attrib +H "%appdata%\Microsoft\Windows\Start Menu\Programs\Windows System" > NUL 2>&1
The account is an admin with UAC disabled and the bat file uses an auto-elevation to run as administrator, so I know that rights are fine. Any help would be appreciated. Open to use cmd, powershell, or even a 3rd party program as long as I can run it in a portable solution.