有没有办法更新现有iFile的内容?我没有看到任何更新内容的方法。所以,我开始考虑通过使用iControl将本地文件上传到BigIP来删除和创建文件。我知道有两个对象可以使用 - 依次为iFileFile和iFile。
有人可以提供此用途吗?以下是我开始使用并得到以下错误。如果我在powershell脚本的同一位置有一个名为random_key_file1的文件,那么iFileFile.create()的正确参数是什么?创建iFileFile对象后,如何在iFile.create()中使用它。
以下链接包含文档,但缺少说明示例:https://devcentral.f5.com/wiki/iControl.LocalLB__iFile__create.ashx https://devcentral.f5.com/wiki/iControl.LocalLB__iFileFile__create.ashx
感谢帮助。
Add-PSSnapIn iControlSnapIn
$conn = Initialize-F5.iControl -HostName $hostName -Username $username -Password $password
if($conn) {
Try
{
Write-Output "Connected to load balancer - $hostName"
$ic = Get-F5.iControl
$iFileFileObjectNames = @("file1")
$filePaths = @("random_key_file1")
$ic.LocalLBiFileFile.create($iFileFileObjectNames,$filePaths)
Write-Output ("file created")
}
Catch
{
Write-Output($error[0]|format-list -force)
}
}
else
{
Write-Error "Connection to loadbalancer failed"
}
错误
Exception : System.Management.Automation.MethodInvocationException: Exception calling "create" with "2"
argument(s): "Exception caught in LocalLB::urn:iControl:LocalLB/iFileFile::create()
Common::InvalidArgument
" ---> System.Web.Services.Protocols.SoapHeaderException: Exception caught in
LocalLB::urn:iControl:LocalLB/iFileFile::create()
Common::InvalidArgument
at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage
message, WebResponse response, Stream responseStream, Boolean asyncCall)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[]
parameters)
at CallSite.Target(Closure , CallSite , Object , Object , Object )
--- End of inner exception stack trace ---
at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext
funcContext, Exception exception)
at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame
frame)
at
System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame
frame)
at
System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame
frame)
TargetObject :
CategoryInfo : NotSpecified: (:) [], MethodInvocationException
FullyQualifiedErrorId : SoapHeaderException
ErrorDetails :
InvocationInfo : System.Management.Automation.InvocationInfo
ScriptStackTrace : at <ScriptBlock>, D:\test.ps1: line 35
at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo : {}
PSMessageDetails :
Answer this Question 0