Hi,
I want to create a local user admin account on each computer in domain client Computers based on the name of domain user account as per requirements given below
1) Set password for “localuser” as “password”
2) Make “user” the member of local administrators group
3) USer must change password at next logon
For example:
I have a domain user account and it is called "mbiden" , the local user account should be called after creating "mbidenAdmin"
That is my PowerShell script with computername and Admin, it creating a local user admin with "Computername+"Admin", but I want to create create local admin based on the domain user account name
$a=$env:computername+"Admin"
New-LocalUser -AccountNeverExpires:$true -Password ( ConvertTo-SecureString -AsPlainText -Force 'password') -Name $a -FullName "Local Administrator" -Description "Local Administrator" | Add-LocalGroupMember -Group administrators
Can anybody help me?
Regards