2017-02-20 3 views
1

私は上記のコマンドを使用して、現在ログインしているユーザーのリストを取得しています。 私は、このコマンドを含むPowerShellスクリプトを実行したときにそれがうまく動作しますが、私はタスクスケジューラから、この同じスクリプトを実行すると、それは次のエラーを与える:

"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)". 
+0

タスクが実行されているユーザーアカウントは? 'quser.exe'は' c:\ windows \ system32'にあり、pathになければなりません。 – vonPryz

答えて

1

QUser.exeCに常駐:\ Windows \ System32。だから、あなたがディレクトリの中に入ってそれを実行すると、それは動作します。

ここでは、すべてのスクリーンショットで同じことを完全に参照しています。

QUser

はそれがお役に立てば幸いです。

関連する問題