0

We're giving an old Windows 8.1 machine away to somebody who needs it and want to take it off the domain. before doing this we need to know the local administrator password.

Logged in to the machine as the domain admin, is there a simple way to reset the machine password before taking it off the domain, so as to still have working credentials?

I tried running

Reset-ComputerMachinePassword

from within Powershell but that didn't ask for any credentials, nor did it return any error. Apparently that changed the credentials it uses to communicate with the domain.

1
  • 1
    Set-LocalUser Administrator -Password (Read-Host -AsSecureString) should work in powershell.
    – SimonS
    Aug 28, 2020 at 22:15

3 Answers 3

1

This can be done from the command prompt.

Open a command prompt as administrator

Now run the following command

net user

This will list all users. Find out the user you want to change the password of...

Now type

net user <username> *

The * will allow you to enter a new password.

For example:

net user MyUser *

Do note, you do not want to change the password of the user called Administrator. Since Windows 8 and up, this user is only used to "Run as administrator" and is disabled by default. It is not the local user you want to change the password of.

Keep in mind that the user should be administrator. By default the main user that was created during install will be administrator, but given you are going to remove them from the domain, you should verify who is administrator. You can do so by running:

net localgroup administrators

If your user is not present here, add them as follows:

net localgroup administrators <username> /add
10
  • Thanks, that seems to have got it. I proposed an edit. I'll accept your answer once the edit's approved or something similar added. Aug 27, 2020 at 15:40
  • This is a one-time thing, why script this or use PowerShell at all? This is really not a prudent use of PowerShell, especially for a single machine. Just use the computer management GUI. This is basic computer management, well before PowerShell ever existed.
    – postanote
    Aug 27, 2020 at 15:59
  • @LPChip, correct, it is disabled by but it is only used at a pristine computer build, since Windows forces you to add a new admin account when you install it. It is really not used for RunAsAdministrator at all, since RAA, requires you to pass in a new user account, if your ar not running as admin, and thus have to pass in a password. Since the user would not know this, that would not work. You can change the default local admin password to whatever you like and this has been possible in every version of Windows to date. It's been a standard thing in enterprises I've worked in for years.
    – postanote
    Aug 27, 2020 at 16:04
  • @postanote it is really not advised to alter the Administrator user on a workstation since Windows 7. This has been confirmed by Microsoft, because of all the problems and malware infections that were in Windows XP. In servers, it is still the default to work with the Administrator user, but not on workstations.
    – LPChip
    Aug 27, 2020 at 19:11
  • I've edited the edit and improved it. :)
    – LPChip
    Aug 27, 2020 at 19:11
1

As for this ...

[is there a simple way to reset the machine password before taking it off the domain]

The machine password is not the user password. The machine password is provided by ADDS on joining the domain.

The default OS admin account is normally disabled on new systems since Win8 RTM. If you look a the account via Computer Management you see that. So, to even use it you'd need to enabled it first anyway. You really don't need to know that at all, since it is only used once, during new system builds. Just create a new user account. set the password and add it to the LocalAdmin group.

You can use several options to reset any user password on a computer.

Without PowerShell

1. Via computer management

   a. Windows Key + X, select computer management, Local Users and Groups, Users, Right-click a user and select set password.
   b. Open Windows Explorer, right-click, this PC, select manage, repeat the above.
   c. Windows Key + R and type compmgmt.msc and repeat the above

2. via cmd.exe

  a. @LPChip already covered regarding 'net user'
  b. Using VBScript 

2. via PowerShell

  a. @LPChip already covered regarding 'net user'
  b. The Local User and Group Management cmdlets, you can download from the Microsoft PowerShellGallery.com.

Find-Module -Name '*LocalUser*' | Format-Table -AutoSize
# Results
<#
Version Name                Repository Description                                                   
------- ----                ---------- -----------                                                   
3.0     LocalUserManagement PSGallery  a module that performs various local user management function
#>


Find-Module -Name '*LocalUser*' | 
Save-Module -Path "$env:USERPROFILE\Documents\WindowsPowerShell\Modules"
Install-Module -Name LocalUserManagement

# Get specifics for a module, cmdlet, or function
(Get-Command -Name Set-LocalUser).Parameters
(Get-Command -Name Set-LocalUser).Parameters.Keys
Get-help -Name Set-LocalUser -Examples
# Results
<#
Set-LocalUser -Name "Admin07" -Description "Description of this account."
$Password = Read-Host -AsSecureString
 $UserAccount = Get-LocalUser -Name "User02"
 $UserAccount | Set-LocalUser -Password $Password
#>
Get-help -Name Set-LocalUser -Full
Get-help -Name Set-LocalUser -Online
2
  • I had already completed the job by the time you added this but thanks for this helpful answer. I accepted the other because I can only accept one and that one was most useful for me, but I'm sure this will be useful for others. Aug 28, 2020 at 8:01
  • 1
    No worries, I am here to assist when and where I can. The point collection stuff, eh, not really the focus of why I do this. Interest, support, edification, results are all that matters.
    – postanote
    Aug 28, 2020 at 8:04
0

You can use below PowerShell script to change Local Admin password on multiple computers remotely. https://techcognizance.com/2020/11/09/how-to-rename-and-reset-local-admin-account-password-in-windows/

1
  • 1
    Welcome to Super User! Please quote the essential parts of the answer from the reference link(s), as the answer can become invalid if the linked page(s) change.
    – DavidPostill
    Jan 1, 2021 at 9:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .