Jump to content

Delete Administrator folder on reboot


Recommended Posts


As far as I know, you can only change the name of the Administrator account and its folder through an unattended installation of Windows. You can change the name as many times as you like when in Windows, but the folder will always be named what was defined during installation.

Link to comment
Share on other sites

Just run the following batch as the administrator, then the administrator's folder is deleted after the next login. But it would be a piitty, if the next user, who logs in, is the administrator. If you want to make sure, that this isn't happening, you could write a little batch, which only deletes the folder, if the logged in user, isn't the administrator.

@echo off
SET KEY=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx
REG ADD %KEY% /V TITLE /D "Installing Applications" /f
REG ADD %KEY%\070 /VE /D "Delete Administrators folder" /f
REG ADD %KEY%\070 /V 1 /D "rmdir /s /Q \"%USERPROFILE%\" " /f

You also could do the job, without having to run the script as the administrator and having the script run before login, but first thing would be a little more complicated ( would have to get the folder's path out of the registry) and the second thing I'M not quite sure, how to do, would be necessary a little reading.

To change the name of administrator's directory, you've got to change the path in

HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\SID\ProfileImagePath, where for SID you have to enter the administrator's SID.

Hope this helps a little.

Edited by Doc Symbiosis
Link to comment
Share on other sites

To change the name of administrator's directory, you've got to change the path in

HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\SID\ProfileImagePath, where for SID you have to enter the administrator's SID.

Well... It works. I'd like to know how to get the SID (domain) through a batch file too. The full string always starts with "S-1-5-21-" and always ends in "-500".

Edited by Tomcat76
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...