1

I am using the above command to get the list of currently logged in users. It works well when I run the powershell script containing this command, but when I run this same script from the task scheduler, it gives the following error:

"The term 'quser' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.",
            "stack_trace": "   at System.Management.Automation.CommandDiscovery.LookupCommandInfo(String commandName, CommandTypes commandTypes, SearchResolutionOptions searchResolutionOptions, CommandOrigin commandOrigin, ExecutionContext context)
   at System.Management.Automation.CommandDiscovery.LookupCommandProcessor(String commandName, CommandOrigin commandOrigin, Nullable`1 useLocalScope)
   at System.Management.Automation.CommandFactory._CreateCommand(String commandName, CommandOrigin commandOrigin, Nullable`1 useLocalScope)
   at System.Management.Automation.ExecutionContext.CreateCommand(String command, Boolean dotSource)
   at System.Management.Automation.PipelineOps.AddCommand(PipelineProcessor pipe, CommandParameterInternal[] commandElements, CommandBaseAst commandBaseAst, CommandRedirection[] redirections, ExecutionContext context)
   at System.Management.Automation.PipelineOps.InvokePipeline(Object input, Boolean ignoreInput, CommandParameterInternal[][] pipeElements, CommandBaseAst[] pipeElementAsts, CommandRedirection[][] commandRedirections, FunctionContext funcContext)
   at System.Management.Automation.Interpreter.ActionCallInstruction`6.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)". 
alroc
  • 27,574
  • 6
  • 51
  • 97
  • Under which user account the task is being run? The `quser.exe` ought to reside in `c:\windows\system32` that should be in path. – vonPryz Feb 20 '17 at 12:17

1 Answers1

1

QUser.exe resides in C:\Windows\System32. So, if you go inside the directory and run it, it will work.

Here is the complete reference for the same with all the screenshots.

QUser

Hope it helps.

Ranadip Dutta
  • 8,857
  • 3
  • 29
  • 45