Add new standard user on windows 10



  • Hi!
    just searching to find a solution to add a new user on PC during or after we deploy the image. Is it possible to remove and add a new standard user on a workgroup computer during or after image deployment? If yes, how we can accomplish that. I appreciate all suggestion and help.



  • @abu.raju said in Add new standard user on windows 10:

    @x23piracy I am retentively new to FOG. I would appreciate if you guys show me how to do this using snapin. Thanks all of you!

    NOTE: This is not working for me. When I run the file locally, it creates the user account. When I attempt running from FOG it does not. I can get it to do other things, but not create the account.
    Ok, here is how I would do it.

    First, create a new PowerShell script. Open up PowerShell ISE and copy/paste the following. Replace with your information.

    $Name = "TestUser"
    $FullName = "Test User"
    $Password = "Password123" | ConvertTo-SecureString -AsPlainText -Force
    $Description = "A standard user account."
    
    New-LocalUser -Name $Name -FullName $FullName -Password $Password -Description $Description
    

    Save it. Name it whatever you want.

    Open your browser. Go to your FOG server page. Click on the Snapins icon, then click Create New Snapin. Fill in the details. Before sure to select the PowerShell option from the Snapin Template. Click the Choose File button to pick your PowerShell script and upload it. Then click the Add button at the bottom (not in screenshot).
    alt text

    After that you’ll need to assign the snapin to your host(s) and when you image it will (by default) run the snapin after deployment.



  • @abu.raju said in Add new standard user on windows 10:

    @x23piracy I am retentively new to FOG. I would appreciate if you guys show me how to do this using snapin. Thanks all of you!

    Ok. Give me a little bit. I want to write it up real fast and make sure it actually works.



  • @x23piracy I am retentively new to FOG. I would appreciate if you guys show me how to do this using snapin. Thanks all of you!



  • @x23piracy said in Add new standard user on windows 10:

    FYI, Powershell command/script can also be used as a snapin.

    Regards X23

    I had intended to say this in previous post, but the fire drill rushed me. lol



  • FYI, Powershell command/script can also be used as a snapin.

    Regards X23



  • @abu.raju said in Add new standard user on windows 10:

    Hi!
    just searching to find a solution to add a new user on PC during or after we deploy the image. Is it possible to remove and add a new standard user on a workgroup computer during or after image deployment? If yes, how we can accomplish that. I appreciate all suggestion and help.

    You can create a new local user with a simple PowerShell command:

    New-LocalUser
    

    Something like this may work, although I haven’t tested it.

    $Name = "TestUser"
    $FullName = "Test User"
    $Password = "Password123" | ConvertTo-SecureString -AsPlainText -Force
    
    New-LocalUser -Name $Name -FullName $FullName -Password $Password -AccountNeverExpires -PasswordNeverExpires
    

    For more details open a PowerShell window and type

    Get-Help New-LocalUser -ShowWindow
    

    Or read through this:

    Synopsis
        Creates a local user account.
    
    Description
        The New-LocalUser cmdlet creates a local user account. This cmdlet creates a local user account or a local user account that is connected to a Microsoft account.
    
    
    Parameters
        -AccountExpires <DateTime>
            Specifies when the user account expires. To obtain a DateTime object, use the Get-Date cmdlet. If you do not specify this parameter, the account does not expire.
    
            Required?                    false
            Position?                    named
            Default value                None
            Accept pipeline input?       True (ByPropertyName)
            Accept wildcard characters?  false
    
        -AccountNeverExpires <SwitchParameter>
            Indicates that the account does not expire.
    
            Required?                    false
            Position?                    named
            Default value                False
            Accept pipeline input?       True (ByPropertyName)
            Accept wildcard characters?  false
    
        -Confirm <SwitchParameter>
            Prompts you for confirmation before running the cmdlet.
    
            Required?                    false
            Position?                    named
            Default value                False
            Accept pipeline input?       False
            Accept wildcard characters?  false
    
        -Description <String>
            Specifies a comment for the user account. The maximum length is 48 characters.
    
            Required?                    false
            Position?                    named
            Default value                None
            Accept pipeline input?       True (ByPropertyName)
            Accept wildcard characters?  false
    
        -Disabled <SwitchParameter>
            Indicates that this cmdlet creates the user account as disabled.
    
            Required?                    false
            Position?                    named
            Default value                False
            Accept pipeline input?       True (ByPropertyName)
            Accept wildcard characters?  false
    
        -FullName <String>
            Specifies the full name for the user account. The full name differs from the user name of the user account.
    
            Required?                    false
            Position?                    named
            Default value                None
            Accept pipeline input?       True (ByPropertyName)
            Accept wildcard characters?  false
    
        -Name <String>
            Specifies the user name for the user account.
            
    
            Required?                    true
            Position?                    0
            Default value                None
            Accept pipeline input?       True (ByPropertyName, ByValue)
            Accept wildcard characters?  false
    
        -NoPassword <SwitchParameter>
            Indicates that the user account does not have a password.
    
            Required?                    true
            Position?                    named
            Default value                False
            Accept pipeline input?       True (ByPropertyName)
            Accept wildcard characters?  false
    
        -Password <SecureString>
            Specifies a password for the user account. You can use `Read-Host -GetCredential`, Get-Credential, or ConvertTo-SecureString to create a SecureString object for the password.
            
    
            Required?                    true
            Position?                    named
            Default value                None
            Accept pipeline input?       True (ByPropertyName)
            Accept wildcard characters?  false
    
        -PasswordNeverExpires <SwitchParameter>
            Indicates whether the password expires.
    
            Required?                    false
            Position?                    named
            Default value                False
            Accept pipeline input?       True (ByPropertyName)
            Accept wildcard characters?  false
    
        -UserMayNotChangePassword <SwitchParameter>
            Indicates that the user cannot change the password on the user account.
    
            Required?                    false
            Position?                    named
            Default value                False
            Accept pipeline input?       True (ByPropertyName)
            Accept wildcard characters?  false
    
        -WhatIf <SwitchParameter>
            Shows what would happen if the cmdlet runs. The cmdlet is not run.
    
            Required?                    false
            Position?                    named
            Default value                False
            Accept pipeline input?       False
            Accept wildcard characters?  false
    
    
    
    Syntax
        New-LocalUser [-Name] <String> [-AccountExpires <DateTime>] [-AccountNeverExpires ] [-Confirm ] [-Description <String>] [-Disabled ] [-FullName <String>] -NoPassword  [-UserMayNotChangePassword ] [-WhatIf ] [<CommonParameters>]
    
        New-LocalUser [-Name] <String> [-AccountExpires <DateTime>] [-AccountNeverExpires ] [-Confirm ] [-Description <String>] [-Disabled ] [-FullName <String>] -Password <SecureString> [-PasswordNeverExpires ] [-UserMayNotChangePassword ] [-WhatIf ] [<CommonParameters>]
    
    
    Inputs
        System.String, System.DateTime, System.Boolean, System.Security.SecureString
        You can pipe a string, a DateTime object, a Boolean value, or a secure string to this cmdlet.
    
    Outputs
        System.Management.Automation.SecurityAccountsManager.LocalUser
        This cmdlet returns a LocalUser object. This object provides information about the user account.
    
    Notes
        * A user name cannot be identical to any other user name or group name on the computer. A user name cannot consist only of periods (.) or spaces. A user name can contain up to 20 uppercase characters or lowercase characters. A user name cannot contain the following characters:
        
    
    Examples
        Example 1: Create a user account
        PS C:\>New-LocalUser -Name "User02" -Description "Description of this account." -NoPassword
        Name    Enabled  Description
        ----    -------  -----------
        User02  True     Description of this account.
        
        This command creates a local user account. The command does not specify the AccountExpires parameter. Therefore, the account does not expire.
        Example 2: Create a user account that has a password
        PS C:\>$Password = Read-Host -AsSecureString
        PS C:\> New-LocalUser "User03" -Password $Password -FullName "Third User" -Description "Description of this account."
        Name    Enabled  Description
        ----    -------  -----------
        User03  True     Description of this account.
        
        The first command prompts you for a password by using the Read-Host cmdlet. The command stores the password as a secure string in the $Password variable.
    
    The second command creates a local user account by using the password stored in $Password. The command specifies a user name, full name, and description for the user account.
        Example 3: Create a user account that is connected to a Microsoft account
        PS C:\>New-LocalUser -Name "MicrosoftAccount\usr name@Outlook.com" -Description "Description of this account."
        
        This command creates a local user account that is connected to a Microsoft account. This example uses a placeholder value for the user name of an account at Outlook.com. Because the account is connected to a Microsoft account, do not specify a password.
    
    
    RelatedLinks
        Online Version: http://go.microsoft.com/fwlink/?LinkId=822516
        Disable-LocalUser
        Enable-LocalUser
        Get-LocalUser
        Remove-LocalUser
        Rename-LocalUser
        Set-LocalUser
    

    And… there’s a fire drill right now… I work in a school.



  • Hi,

    you can use unattend.xml to create a user for the case u use sysprep or simply use command line for example by snapin:

    net user Username Password /add
    

    alt text

    If you also need the user in a specific group use:

    net Localgroup Group_name Username /add
    

    If you want to use it by snapin try to decide to use a batch file or use both command in one line:

    net user Username Password /add & net Localgroup Group_name Username /add
    

    for unattend.xml: http://windowsafg.no-ip.org/win10x86_x64.html

    <UserAccounts>
    <LocalAccounts>
    <LocalAccount wcm:action="add">
    <Password>
    <Value>blabla</Value>
    <PlainText>true</PlainText>
    </Password>
    <Description></Description>
    <DisplayName>NewUser</DisplayName>
    <Group>Administrators</Group>
    <Name>NewUser</Name>
    </LocalAccount>
    </LocalAccounts>
    </UserAccounts>
    

    To delete a user you can use:

    NET USER <Account> /DELETE
    

    But don’t forget to remove the profile first if that user ever logged on, i would recommend delprof2.exe for this:
    https://helgeklein.com/free-tools/delprof2-user-profile-deletion-tool/

    delprof2.exe /q /id:username /i
    

    I also would like to recommend you to read the following thread: https://forums.fogproject.org/topic/9877/windows-10-pro-oem-sysprep-imaging

    Regards X23


  • Moderator

    I’m not sure I 100% understand your question. But this is beyond the scope of FOG.

    If I understand you want to create a local user account after the system is imaged. You can do this in windows unattend.xml file (assuming you sysprep your golden image). You can just complete that section of the xml file for user account creation. This method could create a standard user account on every deployed image.

    The next step is maybe create a machine specific user account, that could be possible too. When you register a target computer with fog, there is a question about assigned user. By using a custom created fog post install script you could update the same unattend.xml file (used above) with the user account defined in fog. To do this, you would need a little linux bash shell scripting and to setup the unattend.xml file in a certain way. But yes its possible.

    Ref: http://www.itninja.com/question/how-do-i-add-a-custom-local-administrator-account-through-sysprep (Search the unattend.xml file for Local Accounts)


Log in to reply
 

327
Online

38724
Users

10553
Topics

99906
Posts

Looks like your connection to FOG Project was lost, please wait while we try to reconnect.