powershell-intune-samples icon indicating copy to clipboard operation
powershell-intune-samples copied to clipboard

Upload timed out

Open xsebamedox opened this issue 6 years ago • 1 comments

Hi there,

When uploading huge intunewin-archives (more than 30 chunks) I get an Exception. I use this function to upload the file:

Upload-Win32Lob -SourceFile "$packagearchive" -publisher "$($textboxPublisher.Text)" -description $($textboxDescription.Text) -detectionRules $DetectionRule -returnCodes $ReturnCodes -installCmdLine "install.cmd install" -displayName "$($textboxPackagename.Text)" -uninstallCmdLine "install.cmd uninstall"

After 7 Minutes of uploading I get an error message and Powershell stops working: This is because he tries to execute the function RenewAzureStorageUpload with $fileuri / renewupload and the Errorresult is the following:

************** Exception Text ************** System.Management.Automation.BreakException: System error. at System.Management.Automation.Interpreter.ThrowInstruction.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.Interpreter.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.LightLambda.RunVoid1[T0](T0 arg0) at System.Management.Automation.PSScriptCmdlet.RunClause(Action 1 clause, Object dollarUnderbar, Object inputToProcess) at System.Management.Automation.PSScriptCmdlet.DoEndProcessing() at System.Management.Automation.CommandProcessorBase.Complete() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(Object input) at System.Management.Automation.PipelineOps.InvokePipeline(Object input, Boolean ignoreInput, CommandParameterInternal[][] pipeElements, CommandBaseAst[] pipeElementAsts, CommandRedirection[][] commandRedirections, FunctionContext funcContext) at System.Management.Automation.Interpreter.ActionCallInstruction6.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.Interpreter.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.LightLambda.RunVoid1[T0](T0 arg0) at System.Management.Automation.ScriptBlock.InvokeWithPipeImpl(ScriptBlockClauseToInvoke clauseToInvoke, Boolean createLocalScope, Dictionary 2 functionsToDefine, List 1 variablesToDefine, ErrorHandlingBehavior errorHandlingBehavior, Object dollarUnder, Object input, Object scriptThis, Pipe outputPipe, InvocationInfo invocationInfo, Object[] args) at System.Management.Automation.ScriptBlock.<>c__DisplayClass57_0.<InvokeWithPipe>b__0() at System.Management.Automation.Runspaces.RunspaceBase.RunActionIfNoRunningPipelinesWithThreadCheck(Action action) at System.Management.Automation.ScriptBlock.InvokeWithPipe(Boolean useLocalScope, ErrorHandlingBehavior errorHandlingBehavior, Object dollarUnder, Object input, Object scriptThis, Pipe outputPipe, InvocationInfo invocationInfo, Boolean propagateAllExceptionsToTop, List 1 variablesToDefine, Dictionary 2 functionsToDefine, Object[] args) at System.Management.Automation.ScriptBlock.InvokeAsDelegateHelper(Object dollarUnder, Object dollarThis, Object[] args) at System.Windows.Forms.Control.OnClick(EventArgs e) at System.Windows.Forms.Button.OnClick(EventArgs e) at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent) at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ButtonBase.WndProc(Message& m) at System.Windows.Forms.Button.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) ************** Loaded Assemblies ************** . . .

It seems that the upload stops exactly after about 7-8 minutes. And this could have something to do with the following line in the function "UploadFileToAzureStorage"

if ($currentChunk -lt $chunks -and $sasRenewalTimer.ElapsedMilliseconds -ge 450000

By changing the 450000 (which is 7,5 minutes) into 15 minutes he wont executes the if-clause but i get a new error: Im able to upload many more chunks of the application but at about chunk 95 (of 125) I get the next error (returncode 403: Forbidden). So i Think intune closes the connection. I also get another Errorlogentry which goes in the same direction:

AuthenticationFailedServer failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature. RequestId:ff8890dc-301e-0075-2xxx-69f898000000 Time: 2019-09-12T12:20:02.0674195ZSigned expiry time [Thu, 12 Sep 2019 12:19:58 GMT] has to be after signed start time [Thu, 12 Sep 2019 12:20:02 GMT].Exception.Message Can you help me find a solution for that?

xsebamedox avatar Sep 11 '19 15:09 xsebamedox

I have the same issue when uploading big size package, is there any way to fix it ?

sky2133 avatar Jan 28 '21 12:01 sky2133