Powershell script message This operation returned because the timeout period expired.
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
Answers (0)
Please log in to answer
Be the first to answer this question
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? - Channeler 7 years ago
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. - j.hough_FNP 7 years ago
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 - j.hough_FNP 7 years ago