Create A Task Sequence Using PowerShell To Rename Local Administrator Account Microsft Deploymen ##BEST##
DOWNLOAD >>> https://cinurl.com/2twjXZ
Create a Task Sequence using PowerShell to Rename Local Administrator Account â Microsft Deployment
In this article, we will show you how to create a task sequence using PowerShell to rename the local administrator account on your Windows devices. This can be useful for security reasons, as it makes it harder for attackers to guess the name of the default administrator account.
To rename the local administrator account, we will use the Rename-LocalUser cmdlet from the Microsoft.PowerShell.LocalAccounts module. This cmdlet allows us to specify the current name, the new name, or the security identifier (SID) of the user account that we want to rename.
Before we create the task sequence, we need to make sure that the Microsoft.PowerShell.LocalAccounts module is available on our devices. This module is not available in 32-bit PowerShell on a 64-bit system, so we need to run our task sequence in 64-bit mode. We also need to enable PowerShell execution policy to allow scripts to run.
Here are the steps to create the task sequence:
Open the Configuration Manager console and go to Software Library > Operating Systems > Task Sequences.
Right-click on Task Sequences and select Create Task Sequence.
Select Create a new custom task sequence and click Next.
Enter a name and description for the task sequence and click Next.
Select Standard Client Task Sequence as the boot image and click Next.
Click Next on the Summary page and click Close on the Completion page.
Right-click on the newly created task sequence and select Edit.
Add a new Run Command Line step at the beginning of the task sequence and enter the following command: powershell.exe -ExecutionPolicy Bypass. This will set the execution policy to bypass for the current session.
Add another Run Command Line step after the previous one and enter the following command: powershell.exe -Command \"Rename-LocalUser -Name 'Administrator' -NewName 'AdminContoso'\". This will rename the local user account named Administrator to AdminContoso. You can change the new name as per your preference.
Optionally, you can add another Run Command Line step after the previous one and enter the following command: powershell.exe -Command \"Restart-Computer\". This will restart the computer after renaming the local administrator account.
Save and close the task sequence editor.
Now you can deploy this task sequence to your devices using Configuration Manager. After running this task sequence, your local administrator account will have a new name that is more secure and less predictable.
If you want to create a local admin user based on the machine name, you can use the following PowerShell command:
powershell.exe -Command \"$a=$env:computername+'Admin'; New-LocalUser -AccountNeverExpires:$true -Password ( ConvertTo-SecureString -AsPlainText -Force 'User@123') -Name $a -FullName 'Local Administrator' -Description 'Local Administrator' Add-LocalGroupMember -Group administrators\"
This command will create a local user account with the name of the machine plus \"Admin\" as the suffix. For example, if the machine name is Test, the local user account will be TestAdmin. You can change the password and other parameters as per your preference.
If you want to add a domain user as an admin, you can use the following PowerShell command:
powershell.exe -Command \"Add-LocalGroupMember -Group administrators -Member 'domain\\username'\"
This command will add the specified domain user to the local administrators group. You need to replace domain\\username with the actual domain and user name that you want to add.
By using these PowerShell commands, you can create and manage local administrator accounts on your Windows devices using Configuration Manager. aa16f39245