Asked by:
Reporting the questiong form WindowsServer general forums

Question
-
One of my script hangs during one of our product installation. Hangs is happening while executing some of the common PowerShell and native ExEs from PowerShell.
more details in below question which is actually in WindowsServer general Forums.
Regards kvprasoon
- Edited by PRASOON KARUNAN V Thursday, February 22, 2018 8:44 PM
Thursday, February 22, 2018 7:38 PM
All replies
-
What EXE is hanging? You need to supply more exact information.
This sounds like more of a break/fix or external program compatibility issue and not really a scripting issue.
\_(ツ)_/
Thursday, February 22, 2018 7:45 PM -
There is only one ExE here, its PowerShell. Hangs are happening while executing some cmdlets in WebAdminstration module.
Hang happens after netsh cmd execution as well.
These hangs are not consistently happening and happens only in 2012 R2, we execute the same in 2008 R2 SP1 which never hanged.
Regards kvprasoon
Thursday, February 22, 2018 8:12 PM -
NETSH is an EXE. What other commands are you using that is an EXE without the extension?
We cannot guess at what you are doing. Network conditions and system processes can cause a script to delay for a long time. Running a script as a scheduled task can create issues. A hidden message box can hang a script.
How can we possible guess at what you are doing?
\_(ツ)_/
Thursday, February 22, 2018 8:23 PM -
Since this all seems to be about web installation it would be best to post in the Web forum. http://forums.iis.net
Web apps installed over an Internet connection can hang because of network issues. NETSH hanging may indicate net issues.
Try running for a different client or on the target web server.
\_(ツ)_/
Thursday, February 22, 2018 8:26 PM -
just curious , does the usage of an exe without extension matters ?
we use msdeploy,iisreset,appcmd as well here for installing web packages, this is another place where it hangs, but hang happens after successful execution of msdeploy.exe. I tried using latest available version of msdeploy, is still hangs some times.
We have around 7 web packages, hang happens after deploying a package as well as before deploying a package.
Code logic here.
Step 1: Test msdeploy exists, if not install it
Step 2 : iisreset (hangs here sometimes)
Step 3 : check if the app pool is available, if so Stop-WebAppPool (hangs here sometimes)
Step 4: install web package using msdeploy
Step 5: get the app pool state and start if it is not started - (some times hangs here)
Step 6: do some app pool settings using appcmd.exe (hangs some times after this execution)
Step 7: some other app pool settings like Set-ItemProperty IIS:\AppPools\$appPoolName -Name recycling.periodicRestart.memory -Value $appPoolRestartMemory
Step 8 : get the next package and go to Step 1
Note: None of the hangs are consistent, each and every time, hang happens in either one place
Regards kvprasoon
- Edited by PRASOON KARUNAN V Thursday, February 22, 2018 8:42 PM
Thursday, February 22, 2018 8:41 PM -
No extension shouldn't matter but the EXE can be replaced with a batch file of the same name and that an contain rogue commands.
Get-Command netsh
This will validate the exe and its location.
I a script it is always a BP to use the full pathname of the EXE to avoid issues.
\_(ツ)_/
Thursday, February 22, 2018 8:44 PM -
Sure I'll post it in IIS forums as well,
This environment is not connected to Public network
Regards kvprasoon
Thursday, February 22, 2018 8:45 PM -
Example:
PS D:\scripts> Get-Command netsh -All CommandType Name Version Source ----------- ---- ------- ------ Application netsh.exe 10.0.16... C:\windows\system32\netsh.exe Application netsh.bat 0.0.0.0 C:\Users\jvierra\AppData\Local\Microsoft\WindowsApps\netsh.bat
The order depends on the order they appear in the path. here the bat is last so it will not be the default.
\_(ツ)_/
Thursday, February 22, 2018 8:48 PM -
Sure I'll post it in IIS forums as well,
This environment is not connected to Public network
Regards kvprasoon
Internal networks can also have issues.
\_(ツ)_/
Thursday, February 22, 2018 8:52 PM -
Basically its a virtual n/w, the execution happens in a VM hosted in VMWare.
any idea on ZwWaitForMultipleObjects routine ?
I have the system with me which is hang state for around 2 days.
Is there any way to release the wait ?
Regards kvprasoon
- Edited by PRASOON KARUNAN V Thursday, February 22, 2018 9:06 PM
Thursday, February 22, 2018 9:05 PM -
"Wait" on objects needs a timeout or it will wait forever. It may not work as expected in PowerShell.
What are you waiting for?
\_(ツ)_/
Thursday, February 22, 2018 9:23 PM -
This info is the last item found in stack while analyzing the processes dumb for hanged PowerShell.exe .
Regards kvprasoon
Friday, February 23, 2018 5:28 AM