【发布时间】:2021-05-13 23:34:54
【问题描述】:
如果我运行此代码,它将运行文件
{Write-host "Please Enter the email address of the user you want to check the permissions"
$user = Read-Host
Powershell.exe C:\Temp\Report\Reports.ps1}
但是如果我像这样运行它,这就是我需要做的
{ Write-host "Please Enter the email address of the user you want to check the permissions"
$user = Read-Host
Powershell.exe C:\Temp\Report\Reports.ps1 -processOneDrive $true -OneDriveEmail $user}
我收到此错误
Powershell.exe : C:\Temp\ReportSharedFiles\ReportSharedFiles.ps1 : Missing an argument for parameter 'OneDriveEmail'. Specify a
At C:\Temp\ReportSharedFiles\Full Exchange Script Menu.ps1:88 char:2
+ Powershell.exe "c:\Temp\ReportSharedFiles\ReportSharedFiles.ps1" -pr ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (C:\Temp\ReportS...il'. Specify a :String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
parameter of type 'System.String' and try again.
At line:1 char:71
+ ... haredFiles\ReportSharedFiles.ps1 -processOneDrive True -OneDriveEmail
+ ~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [ReportSharedFiles.ps1], ParameterBindingException
+ FullyQualifiedErrorId : MissingArgument,ReportSharedFiles.ps1
我做错了什么,我怎样才能让它工作?任何帮助将不胜感激
【问题讨论】:
-
是您的 reports.ps1 文件调用 C:\Temp\Report\Full Exchange Script Menu.ps1。如果是这样,请检查 Full Exchange Script Menu.ps1 中的 line:88 char:2 与开关冲突 -processOneDrive $true -OneDriveEmail $user
-
@ClintOliveira 抱歉是错误的错误,我修复了该错误并更改了编辑错误。这就是我在第 88 行所拥有的
Powershell.exe "c:\Temp\Report\Reports.ps1" -processOneDrive $true -OneDriveEmail它就像它不喜欢阅读我出于某种原因提出的论点一样。没有它们它会正常工作,但我需要它们
标签: powershell scripting office365 powershell-3.0 powershell-4.0