2

Login is with a pin code and right clicking on cmd allows running in an elevated mode as Administrator so that new accounts can be created:

adding a user:

PS C:\Windows\System32>
PS C:\Windows\System32> New-LocalUser

cmdlet New-LocalUser at command pipeline position 1
Supply values for the following parameters:
Name: nicholas
Password: *****************************************

Name     Enabled Description
----     ------- -----------
nicholas True


PS C:\Windows\System32>
PS C:\Windows\System32>
PS C:\Windows\System32> Get-LocalUser

Name               Enabled Description
----               ------- -----------
Administrator      False   Built-in account for administering the =
computer/domain
DefaultAccount     False   A user account managed by the system.
defaultuser100001  True
foo                True
Guest              False   Built-in account for guest access to the =
computer/domain
nicholas           True
WDAGUtilityAccount False   A user account managed and used by the system =
for Windows Defender Application Guard scen...


PS C:\Windows\System32>

While the Administrator account isn't enabled, the foo user can run cmd with Administrator privileges. The newly created account shows as enabled yet isn't available from the login-screen as an option.

system info:

PS C:\Users\foo>
PS C:\Users\foo> [System.Environment]::OSVersion

Platform ServicePack Version      VersionString
-------- ----------- -------      -------------
 Win32NT             10.0.22621.0 Microsoft Windows NT 10.0.22621.0


PS C:\Users\foo>
PS C:\Users\foo>
PS C:\Users\foo> cmd /c ver

Microsoft Windows [Version 10.0.22621.1105]
PS C:\Users\foo>

While Windows 10 is shown above, winver shows Windows 11:

winver

the newly created user isn't listed as an option to login. There are no options, only the single account.

I'm not understanding the finer points distinguishing an account from a profile. Can I not login as a different user somehow?


From IRC, a suggestion from Akik is to run:

 FOR %F IN ("%SystemRoot%\servicing\Packages\Microsoft-Windows-GroupPolicy-ClientTools-Package~*.mum") DO (DISM /Online /NoRestart /Add-Package:"%F")

and another suggestion from j​borean93 is:

https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.localaccounts/set-localuser?view=powershell-5.1

11
  • 1
    10.0.22621.0 always has been Windows 11 22H2
    – Ramhound
    Commented Jan 26, 2023 at 4:13
  • 1
    It’s unnecessary. Your running Windows 11 22H2 based on the build your running. Your issue isn’t unique to the version of Windows you’re running. I am guessing the machine is connected to an AD domain?
    – Ramhound
    Commented Jan 26, 2023 at 4:16
  • 1
    Windows 11 Home cannot join an AD domain
    – Ramhound
    Commented Jan 26, 2023 at 4:42
  • 1
    Did you try to add a user via the GUI yet? what happens if you use the text login prompt can you log in via any user and via the new user?
    – Albin
    Commented Jan 26, 2023 at 7:23
  • 1
    the non-gui login, where you have to enter the username AND the password via the keyboard. Please also add a user through the Windows settings (NOT through the control panel).
    – Albin
    Commented Jan 26, 2023 at 17:56

1 Answer 1

2

Your new users need to be a member of the Users group. Here is a simple script I use for creating users

param ($Site, $FullName, $UserName, $Password, [switch] $Admin)
if ($PSBoundParameters.ContainsKey('UserName')) {
    if ($PSBoundParameters.ContainsKey('Admin')) {
        $Description = "Admin account for $FullName"
    }
    else {
        $Description = "User account for $FullName"
    }
    if (-Not ($PSBoundParameters.ContainsKey('Password'))) {
        $Credential = Get-Credential -UserName $UserName -Message "Supply password for new user"
        $User = New-LocalUser -FullName "$($FullName) - $($Site)" -Name $UserName -Description $Description -PasswordNeverExpires -Password $Credential.Password
    }
    else {
        $User = New-LocalUser -FullName "$($FullName) - $($Site)" -Name $UserName -Description $Description -PasswordNeverExpires -Password (ConvertTo-SecureString -String $Password -AsPlainText -Force)
    }
    if ($null -ne $User) {
        Add-LocalGroupMember -Group "Users"  -Member $User 
        if ($PSBoundParameters.ContainsKey('Admin')) {
            Add-LocalGroupMember -Group "Administrators" -Member $User 
        }
        Write-Output $User
    }
}
else {
    Write-Host "Usage: $(Split-Path $PSCommandPath -leaf) <Site> <Full Name> <Username> [password] [-Admin]"
}

For your situation you could use Add-LocalGroupMember -Group "Users" -Member "nicholas"

2
  • 1
    A bit more information on your code might be helpful for readers with little experience
    – Albin
    Commented Dec 14, 2023 at 14:04
  • +1 for the code, superb! Commented Jan 26 at 17:52

You must log in to answer this question.

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