I'll explain the script:
- First it will be checked, if a new version of our application was created/built
- ( because of the problem i've told, i inserted some registry-checks to know if a server restart is required )
- if a new version is available, the ZIP of the new version will extracted und the MSI-file inside will be installed with msiexec as shown before
I now tried the following steps:
- added the transcript-option in powershell
- start the handle.exe right before the msiexec is executed
- added the /norestart-parameter to the msiexec
But nothing of them helped.
(I also tried the "/qn" option, but this is not usable for us).
Here is the transcript:
**********************
nStart der Windows PowerShell-Aufzeichnung
Startzeit: 20230430113636
Benutzername: MYDOMAIN\administrator
RunAs-Benutzer: MYDOMAIN\administrator
Konfigurationsname:
Computer: APPSRV1 (Microsoft Windows NT 10.0.17763.0)
Hostanwendung: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe C:\LC.Scripts\qstest\InstallMyApplication.ps1 C:\LC.Scripts\qstest\InstallMyApplication.config.xml
Prozess-ID: 8652
PSVersion: 5.1.17763.3770
PSEdition: Desktop
PSCompatibleVersions: 1.0, 2.0, 3.0, 4.0, 5.0, 5.1.17763.3770
BuildVersion: 10.0.17763.3770
CLRVersion: 4.0.30319.42000
WSManStackVersion: 3.0
PSRemotingProtocolVersion: 2.3
SerializationVersion: 1.1.0.1
**********************
Die Aufzeichnung wurde gestartet. Die Ausgabedatei ist "c:\install\MyApplication\InstallMyApplication.transcript.txt".
[?] Check if a reboot is pending for this machine...
PS>TerminatingError(Get-ItemProperty): "Der ausgeführte Befehl wurde beendet, da die Einstellungsvariable "ErrorActionPreference" oder ein allgemeiner Parameter auf "Stop" festgelegt ist: Die Eigenschaft RebootInProgress ist im Pfad HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Component Based Servicing nicht vorhanden.."
PS>TerminatingError(Get-ItemProperty): "Der ausgeführte Befehl wurde beendet, da die Einstellungsvariable "ErrorActionPreference" oder ein allgemeiner Parameter auf "Stop" festgelegt ist: Die Eigenschaft PackagesPending ist im Pfad HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Component Based Servicing nicht vorhanden.."
HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager > PendingFileRenameOperations ... will be ignored
PS>TerminatingError(Get-ItemProperty): "Der ausgeführte Befehl wurde beendet, da die Einstellungsvariable "ErrorActionPreference" oder ein allgemeiner Parameter auf "Stop" festgelegt ist: Die Eigenschaft PendingFileRenameOperations2 ist im Pfad HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager nicht vorhanden.."
PS>TerminatingError(Get-ItemProperty): "Der ausgeführte Befehl wurde beendet, da die Einstellungsvariable "ErrorActionPreference" oder ein allgemeiner Parameter auf "Stop" festgelegt ist: Die Eigenschaft DVDRebootSignal ist im Pfad HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce nicht vorhanden.."
PS>TerminatingError(Get-ItemProperty): "Der ausgeführte Befehl wurde beendet, da die Einstellungsvariable "ErrorActionPreference" oder ein allgemeiner Parameter auf "Stop" festgelegt ist: Die Eigenschaft JoinDomain ist im Pfad HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Netlogon nicht vorhanden.."
PS>TerminatingError(Get-ItemProperty): "Der ausgeführte Befehl wurde beendet, da die Einstellungsvariable "ErrorActionPreference" oder ein allgemeiner Parameter auf "Stop" festgelegt ist: Die Eigenschaft AvoidSpnSet ist im Pfad HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Netlogon nicht vorhanden.."
False
[?] Detect installed MyApplication version...
[i] MyApplication version 5.4.9.0 detected.
[i] Already tested versions:
--- 5.4.10.0
[+] MyApplication version 5.4.10.0 selected.
[+] Installing MyApplication 5.4.10.0 - please wait...
7-Zip [64] 16.04 : Copyright (c) 1999-2016 Igor Pavlov : 2016-10-04
Scanning the drive for archives:
1 file, 557262673 bytes (532 MiB)
Extracting archive: \\Fileserver\Published\Versions\MyApplication5.4.10.0.zip
--
Path = \\Fileserver\Published\Versions\MyApplication5.4.10.0.zip
Type = zip
Physical Size = 557262673
Everything is Ok
Files: 2
Size: 583786977
Compressed: 557262673
Verzeichnis: C:\inetpub\wwwroot\MyRootFolder\Company
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 30.04.2023 11:37 0 AutoInstall.txt
[+] Run handle.exe for debugging...
[+] Start-Process msiexec for WiX...
And the output of handle.exe:
Nthandle v5.0 - Handle viewer
Copyright (C) 1997-2022 Mark Russinovich
Sysinternals - www.sysinternals.com
40: File (RW-) C:\Windows\System32
C4: File (R-D) C:\Windows\System32\WindowsPowerShell\v1.0\de-DE\powershell.exe.mui
CC: File (R-D) C:\Windows\Microsoft.NET\assembly\GAC_MSIL\System.Management.Automation.Resources\v4.0_3.0.0.0_de_31bf3856ad364e35\System.Management.Automation.Resources.dll
178: Section \BaseNamedObjects\__ComCatalogCache__
17C: File (R--) C:\Windows\Registration\R00000000000c.clb
210: Section \...\Cor_SxSPublic_IPCBlock
214: Section \BaseNamedObjects\Cor_Private_IPCBlock_v4_8652
228: Section \Sessions\7\BaseNamedObjects\windows_shell_global_counters
244: Section \BaseNamedObjects\windows_shell_global_counters
24C: Section \BaseNamedObjects\C:*ProgramData*Microsoft*Windows*Caches*cversions.2.ro
250: Section \BaseNamedObjects\C:*ProgramData*Microsoft*Windows*Caches*{6AF0698E-D558-4F6E-9B3C-3716689AF493}.2.ver0x0000000000000008.db
254: Section \BaseNamedObjects\C:*ProgramData*Microsoft*Windows*Caches*cversions.2.ro
258: Section \BaseNamedObjects\C:*ProgramData*Microsoft*Windows*Caches*{DDF571F2-BE98-426D-8288-1A9A39C3FDA2}.2.ver0x0000000000000005.db
25C: File (R-D) C:\Windows\System32\de-DE\propsys.dll.mui
448: File (R--) C:\Windows\assembly\pubpol95.dat
470: Section \BaseNamedObjects\__ComCatalogCache__
484: Section \RPC Control\DSEC21CC
528: File (R-D) C:\Windows\System32\de-DE\winnlsres.dll.mui
710: File (R-D) C:\Windows\System32\de-DE\crypt32.dll.mui
760: File (R-D) C:\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.PowerShell.ConsoleHost.Resources\v4.0_3.0.0.0_de_31bf3856ad364e35\Microsoft.PowerShell.ConsoleHost.Resources.dll
770: File (R-D) C:\Windows\Microsoft.NET\assembly\GAC_MSIL\mscorlib.resources\v4.0_4.0.0.0_de_b77a5c561934e089\mscorlib.resources.dll
928: Section \Sessions\7\BaseNamedObjects\UrlZonesSM_administrator
940: Section \BaseNamedObjects\NLS_CodePage_1252_3_2_0_0
A48: File (R-D) C:\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.PowerShell.Commands.Management.Resources\v4.0_3.0.0.0_de_31bf3856ad364e35\Microsoft.PowerShell.Commands.Management.Resources.dll
A4C: File (R-D) C:\Windows\Microsoft.NET\assembly\GAC_64\System.Transactions\v4.0_4.0.0.0__b77a5c561934e089\System.Transactions.dll
A5C: Section \BaseNamedObjects\NLS_CodePage_850_3_2_0_0
A74: File (R--) C:\install\MyApplication\InstallMyApplication.transcript.txt
B7C: File (R-D) C:\inetpub\wwwroot\WebServicesRoot\ServerConfigurator\bin\MyApplication.exe
BB4: File (R-D) C:\Windows\System32\de-DE\KernelBase.dll.mui
BF4: File (R--) C:\install\MyApplication\InstallMyApplication.handle.txt
C24: File (R-D) C:\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.IIS.PowerShell.Provider.Resources\v4.0_10.0.0.0_de_31bf3856ad364e35\Microsoft.IIS.PowerShell.Provider.resources.dll
C50: File (RWD) C:\Windows\System32\inetsrv\Config\Schema
C58: File (RWD) C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config
C5C: File (RWD) C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config
C60: File (RWD) C:\Windows\System32\inetsrv\Config
C64: File (RWD) C:\Windows\System32\inetsrv\Config
The only file that could cause an "error" (in my opinion) would be "c:\inetpub\wwwroot\WebServicesRoot\ServerConfigurator\bin\MyApplication.exe". But it doesn't explain why the powershell script will be terminated.
Interestingly, the same script works on our test servers (also Windows Server 2019) but not on the application server (but it has worked for a while). On all machines we install the application with the domain-administrator, we can therefore rule out that the user has something to do with it.