以SYSTEM身份运行directory-treesize.ps1时遇ArgumentOutOfRangeException错误
SYSTEM用户运行directory-treesize.ps1脚本报错问题
执行详情
- 脚本:directory-treesize.ps1
- 执行身份:SYSTEM用户
- 运行命令:
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -file "C:\scripts\directory-treesize.ps1" -depth 5 -directory "D:\" -minSizeGB 30 -notree -noColor -logFile "c:\scripts\details.txt"
错误信息
[dotNet]::Start($directory, $minSizeGB, $depth, [bool]$showFiles, ...~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- CategoryInfo : NotSpecified: (:) [], MethodInvocationException
- FullyQualifiedErrorId : ArgumentOutOfRangeException
补充说明
- 普通用户身份运行该脚本无异常
- 脚本在Windows 10、Server 2012 R2系统上运行正常,仅在Server 2022上失败
- PowerShell 5.1及PowerShell 7版本均出现相同错误
内容的提问来源于stack exchange,提问作者Alex Lum
相关产品推荐
相关产品推荐

