使用任务计划程序时访问路径被拒绝和一些其他错误

时间:2017-02-20 06:33:43

标签: powershell access denied unauthorizedaccessexcepti

  • 脚本从Powershell终端完美运行
  • 仅在使用“任务计划程序”
  • 运行时出现问题
  • 我没有管理员权限,而是使用-ExecutionPolicy Bypass
  • 运行此权限
  • 可能我的管理员锁定了我对C:\的访问权限,但是创建文件夹并访问它是正常的

以下是错误输出:

out-file : Access to the path 'C:\Windows\system32\1' is denied.
At C:\scripts\xxx.ps1:7 char:4
 + if($day>1){$offset= -2}
 +  
 + CategoryInfo: OpenError: (:) [Out-File], UnauthorizedAccessException
 + FullyQualifiedErrorId : Fileopenfailure,Microsoft.Powershell.Commands.OutFileCommand

如果需要完整代码,我可以删除auth部分并将其放置。

0 个答案:

没有答案