Windows powershell - missing argument parameter

YAEL ELIAS 1 Reputation point
2022-09-16T16:34:50.313+00:00

net user Game Account /time:M-F,6am-8am;M-F,3pm-5pm;M-F,8pm-10pm

error:
At line:1 char:44

  • net user Game Account /time:M-F,6am-8am;M-F,3pm-5pm;M-F,8pm-10pm
  • ~
    Missing argument in parameter list.
    At line:1 char:56
  • net user Game Account /time:M-F,6am-8am;M-F,3pm-5pm;M-F,8pm-10pm
  • ~
    Missing argument in parameter list.
  • CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
  • FullyQualifiedErrorId : MissingArgument
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,532 questions
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. MotoX80 33,826 Reputation points
    2022-09-16T17:33:04.213+00:00

    You need to put quotes around the times in addition to the account name (if you have spaces in the account name".

    net user "Game Account" /times:"M-F,6am-8am;M-F,3pm-5pm;M-F,8pm-10pm"  
    
    2 people found this answer helpful.

  2. Dillon Silzer 57,491 Reputation points
    2022-09-16T16:46:27.497+00:00

    Hi @YAEL ELIAS

    1) Try running this from an Administrator cmd prompt.

    241869-image.png

    2) Try adding "" around Game Account (i.e. net user "Game Account" /time:M-F,6am-8am;M-F,3pm-5pm;M-F,8pm-10pm)


    If this is helpful please accept answer.

    0 comments No comments

  3. Andreas Baumgarten 109.9K Reputation points MVP
    2022-09-16T16:51:38.73+00:00

    Hi @YAEL ELIAS ,

    please run the command in a Command Prompt with elevated permission. It looks like in PowerShell it's not possible to run the command this way.

    ----------

    (If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

    Regards
    Andreas Baumgarten

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.