command = "net user administrator /active:yes"
subprocess.run(command, check=True, shell=True)
print("Administrator account has been activated successfully.")
except subprocess.CalledProcessError as error:
The `activate_admin_account` function uses the `subprocess` module to run the command to activate the administrator account in Windows 10. The `check` parameter is set to `True` to raise an error if the command fails to run, and the `shell` parameter is set to `True` to run the command in the Windows command prompt.
Upon successful activation of the administrator account, the function prints a success message. In case of an error, the function prints the error message returned by the command output. Note that this code is a simplified version and may require additional error handling and security measures to be safely used in production environments.
Configuring the Built-in Administrator Password on Windows 10
|Step 1||Press the Windows key + X on your keyboard to open the Power User menu.|
|Step 2||Select “Computer Management” from the menu.|
|Step 3||Click “Local Users and Groups” in the left pane.|
|Step 4||Click “Users” in the left pane.|
|Step 5||Right-click on the “Administrator” account in the middle pane.|
|Step 6||Click “Set Password”.|
|Step 7||Click “Proceed” on the pop-up window.|
|Step 8||Enter your desired password in the “New password” and “Confirm password” fields.|
|Step 9||Click “OK” to save the changes.|