/build/static/layout/Breadcrumb_cap_w.png

Scripting Question


Powershell script message This operation returned because the timeout period expired.

11/17/2017 2979 views
Hi,

I'm trying to push out a powershell script to remove the Windows 10 Mail app on all our users machines.  We've had quite a few users who started using that instead of Outlook and we don't want any confusion on that.  

I've created a ps1 file with only this as the contents

get-appxpackage *microsoft.windowscommunicationsapps* | remove-appxpackage


I've saved it as script.ps1.


Created a new online kshell script with the following settings:


Windows Run As: Local System

Dependencies: script.ps1

Task Verify - Launch $(KACE_DEPENDENCY_DIR)\%SystemRoot%\sysnative\WindowsPowerShell\v1.0\Powershell.exe with params -nologo -executionpolicy bypass -WindowStyle hidden -noprofile -file script.ps1 wait='true'.

Task On Success: Log PS sript has been executed successfully! to status.


When I run it to a Win10 x64 vm, it says it's successful but here's what the log says (i've noticed it says "wait='true'" twice on there, it said it before I added the command to the end of the verify task, same result either way):

Output Log

Running as SYSTEM
get-appxpackage : This operation returned because the timeout period expired.
This operation returned because the timeout period expired.
At C:\ProgramData\Dell\KACE\kbots_cache\packages\kbots\259\script.ps1:1 char:1
+ get-appxpackage microsoft.windowscommunicationsapps | remove-appxpack ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : NotSpecified: (:) [Get-AppxPackage], Exception
+ FullyQualifiedErrorId : System.Exception,Microsoft.Windows.Appx.PackageM
anager.Commands.GetAppxPackageCommand
Launched Process: %SystemRoot%\sysnative\WindowsPowerShell\v1.0\Powershell.exe

Status Log

PS sript has been executed successfully!

Activity Log

verify - launch_program
Launching program: 'C:\ProgramData\Dell\KACE\kbots_cache\packages\kbots\259\%SystemRoot%\sysnative\WindowsPowerShell\v1.0\Powershell.exe' '-nologo -executionpolicy bypass -WindowStyle hidden -noprofile -file "script.ps1" wait='true'' wait='true'
verify - on_verify_success
verify - on_verify_failure
verify - log_message

Debug Log

Running kbot: runkbot 259 1510946636
KBotScript::LogScriptInfo - Start
id=259 name=Remove Windows 10 Mail App version=1510946631 type=policy
execute disconnected=false logged_off=true
execute events
KBotScript::LogScriptInfo - Finish
KBotScript::LogScriptInfo - Start
id=259 name=Remove Windows 10 Mail App version=1510946631 type=policy
execute disconnected=false logged_off=true
execute events
KBotScript::LogScriptInfo - Finish
KBotScriptManager::CleanupDependencies - clean up dependencies in kbot directory C:\ProgramData\Dell\KACE\kbots_cache\\packages\kbots\259\
CleanupDependencies: file script.ps1 is part of the dependency list, keep the file
runkbot    ----- launching [path='C:\ProgramData\Dell\KACE\kbots_cache\packages\kbots\259' program='%SystemRoot%\sysnative\WindowsPowerShell\v1.0\Powershell.exe' parms='-nologo -executionpolicy bypass -WindowStyle hidden -noprofile -file "script.ps1" wait='true'' wait='true'] -----
runkbot    ----- completed [exitCode=0] -----

All the steps i've taken were from posts I saw here and https://support.quest.com/kace-systems-management-appliance/kb/138389

Any thoughts?

Thanks
2 Comments   [ + ] Show comments

Comments

  • Never seen that one before.

    I was reading here and there, it seems there is a timeout value for PS scripts
    http://www.winadmin.ro/2016/11/19/again-about-troubleshooting-ad-powershell-queries-this-operation-returned-because-the-timeout-period-expiredmicrosoft-activedirectory-management-commands-getaduser/

    https://stackoverflow.com/questions/32454338/this-operation-returned-because-the-timeout-period-expired-error

    But they are all involved with AD and Windows Server... Have you tried testing your script against a Local Windows account that has Mail app installed?

    Also the script is Running as SYSTEM, Have you tried running as Logged-in user or with a Domain Admin Account?
    • same result it just changed the first line of the results to running as my user account.

      I have not tried running the script just on the machine itself without using kace. I know the command itself works if you just run it via powershell. I'll test that now.
    • Nope, well I guess I need to get the script execution working first. d'oh.

      C:\WINDOWS\system32>Powershell.exe -executionpolicy bypass -file "C:\ProgramData\Dell\KACE\scripts\259\script.ps1" wait='true'
      get-appxpackage : This operation returned because the timeout period expired.
      This operation returned because the timeout period expired.
      At C:\ProgramData\Dell\KACE\scripts\259\script.ps1:1 char:1
      + get-appxpackage *microsoft.windowscommunicationsapps* | remove-appxpa ...
      + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      + CategoryInfo : NotSpecified: (:) [Get-AppxPackage], Exception
      + FullyQualifiedErrorId : System.Exception,Microsoft.Windows.Appx.PackageManager.Commands.GetAppxPackageCommand
  • Nevermind, scrapping this... our server admins are just going to push it out through GP.

Be the first to answer this question

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

View more:

Share

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ