Powershell quser/SERVER:$computerName | Out文件c:\abc.txt
我正在使用上述命令获取当前登录用户的列表。 当我运行包含此命令的powershell脚本时,它运行良好,但当我从任务计划程序运行此脚本时,它会出现以下错误:Powershell quser/SERVER:$computerName | Out文件c:\abc.txt,powershell,taskscheduler,Powershell,Taskscheduler,我正在使用上述命令获取当前登录用户的列表。 当我运行包含此命令的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
"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)".
QUser.exe驻留在C:\Windows\System32中。因此,如果您进入目录并运行它,它将工作 以下是所有截图的完整参考
希望有帮助。任务是在哪个用户帐户下运行的?
quser.exe
应该位于路径中的c:\windows\system32
中。