codaamok / PoSH

A collection of PowerShell scripts I've written.
MIT License
24 stars 6 forks source link

Failed to install Configuration Manager with ActionPreferenceStopException #11

Closed DrummerViking closed 3 years ago

DrummerViking commented 3 years ago

I have recently clone your repository and attempted to run the script for CM-2103.ps1.

its failing to install the CM role with:

18:36:29|03:21:48|00:07:29.376|       - .Installing Custom Role 'CM-2103' on machine 'lab1cm01'                                                                
18:36:30|03:21:49|00:00:00.000|         - Starting miscellaneous items download process                                                                        
18:36:30|03:21:49|00:00:00.000|           - Downloading SQL Native Client                                                                                      
18:36:30|03:21:49|00:00:00.031|             - SQL Native Client MSI already exists, delete 'E:\LabSources\SoftwarePackages\sqlncli.msi' if you want to download again                                                                                                                                                         18:36:30|03:21:49|00:00:00.038|             - Activity Done                                                                                                    18:36:30|03:21:49|00:00:00.052|           - Finished miscellaneous items download process                                                                      18:36:30|03:21:49|00:00:00.000|         - Starting ADK and WinPE download process                                                                              18:36:31|03:21:49|00:00:00.000|           - Downloading 'adksetup.exe' to 'E:\LabSources\SoftwarePackages'                                                     18:36:31|03:21:49|00:00:00.005|             - File already exists, skipping the download. Delete if you want to download again.                                18:36:31|03:21:49|00:00:00.013|             - Activity done                                                                                                    18:36:31|03:21:49|00:00:00.000|           - Downloading ADK files to 'E:\LabSources\SoftwarePackages\ADK'                                                      18:36:31|03:21:49|00:00:00.007|             - Directory already exist, skipping the download. Delete the directory if you want to download again.              18:36:31|03:21:49|00:00:00.011|             - Activity done                                                                                                    18:36:31|03:21:49|00:00:00.000|           - Downloading 'adkwinpesetup.exe' to 'E:\LabSources\SoftwarePackages'                                                18:36:31|03:21:49|00:00:00.010|             - File already exists, skipping the download. Delete if you want to download again.                                18:36:31|03:21:49|00:00:00.019|             - Activity done                                                                                                    18:36:31|03:21:49|00:00:00.000|           - Downloading WinPE files to 'E:\LabSources\SoftwarePackages\WinPE'                                                  18:36:31|03:21:49|00:00:00.006|             - Directory already exists, skipping the download. Delete the directory if you want to download again.             18:36:31|03:21:49|00:00:00.011|             - Activity done                                                                                                    18:36:31|03:21:49|00:00:00.025|           - Finished ADK / WinPE download process                                                                              18:36:31|03:21:49|00:00:00.000|         - Starting Configuration Manager and prerequisites download process                                                    18:36:31|03:21:49|00:00:00.000|           - Downloading 'MEM_Configmgr_2103.zip' to 'E:\LabSources\SoftwarePackages'                                           18:36:31|03:21:49|00:00:00.007|             - File already exists, skipping the download. Delete if you want to download again.                                18:36:31|03:21:49|00:00:00.017|             - Activity done                                                                                                    18:36:31|03:21:49|00:00:00.000|           - Extracting 'MEM_Configmgr_2103.zip' to 'E:\LabSources\SoftwarePackages\CM2103-CB'                                  18:36:31|03:21:49|00:00:00.009|             - Directory already exists, skipping the extraction. Delete the directory if you want to extract again.            18:36:31|03:21:49|00:00:00.014|             - Activity done                                                                                                    18:36:31|03:21:49|00:00:00.000|           - Downloading prerequisites to 'E:\LabSources\SoftwarePackages\CM2103-PreReqs-CB'                                    18:36:31|03:21:49|00:00:00.005|             - Directory already exists, skipping the download. Delete the directory if you want to download again.             18:36:31|03:21:49|00:00:00.009|             - Activity done                                                                                                    18:36:31|03:21:49|00:00:00.022|           - Finished CM binaries and prerequisites download process                                                            18:36:31|03:21:50|00:00:00.000|         - Starting site install process                                                                                        18:36:34|03:21:53|00:00:00.000|           - Running pre-req checks                                                                                             18:36:34|03:21:53|00:00:00.000|             - Checking if site is already installed                                                                            18:36:48|03:22:06|00:00:13.650|               - ..                                                                                                             18:36:50|03:22:08|00:00:15.696|               - No site found, continuing                                                                                      18:36:50|03:22:08|00:00:15.704|               - Activity done                                                                                                  18:36:50|03:22:08|00:00:15.716|             - Found ADK directory 'E:\LabSources\SoftwarePackages\ADK'                                                         18:36:50|03:22:08|00:00:15.724|             - Found WinPE directory 'E:\LabSources\SoftwarePackages\WinPE'                                                     18:36:50|03:22:08|00:00:15.732|             - Found CM install directory in 'E:\LabSources\SoftwarePackages\CM2103-CB'                                         18:36:50|03:22:08|00:00:15.739|             - Found CM pre-reqs directory in 'E:\LabSources\SoftwarePackages\CM2103-PreReqs-CB'                                18:36:50|03:22:08|00:00:15.753|             - Activity done                                                                                                    18:36:50|03:22:09|00:00:00.000|           - Adding Windows Defender exclusions                                                                                 18:36:57|03:22:16|00:00:07.263|             - ..                                                                                                               18:37:01|03:22:20|00:00:11.314|             - Activity done                                                                                                    18:37:01|03:22:20|00:00:00.000|           - Bringing online additional disks                                                                                   18:37:09|03:22:28|00:00:07.867|             - ...                                                                                                              18:37:19|03:22:38|00:00:17.976|             - Activity done                                                                                                    18:37:19|03:22:38|00:00:00.000|           - Saving NO_SMS_ON_DRIVE.SMS file on C: and F:                                                                       18:37:26|03:22:45|00:00:06.908|             - ..                                                                                                               18:37:26|03:22:45|00:00:06.934|             - Activity done                                                                                                    18:37:26|03:22:45|00:00:00.000|           - Creating directory for WSUS                                                                                        18:37:33|03:22:51|00:00:06.372|             - ..                                                                                                               18:37:33|03:22:51|00:00:06.395|             - Activity done                                                                                                    18:37:33|03:22:51|00:00:00.000|           - Copying files                                                                                                      18:51:32|03:36:51|00:13:59.808|             - Activity done                                                                                                    18:51:32|03:36:51|00:00:00.000|           - Installing SQL Server Native Client                                                                                18:51:41|03:37:00|00:00:08.849|             - ....                                                                                                             18:52:06|03:37:25|00:00:34.114|             - Activity done                                                                                                    18:52:06|03:37:25|00:00:00.000|           - Restarting server                                                                                                  18:52:24|03:37:43|00:00:17.441|             - ....................                                                                                             18:57:09|03:42:27|00:05:02.040|             - Activity done                                                                                                    18:57:09|03:42:27|00:00:00.000|           - Extending the AD Schema                                                                                            18:57:31|03:42:50|00:00:22.903|             - ..........                                                                                                       18:58:52|03:44:11|00:01:43.517|             - Activity done                                                                                                    18:58:52|03:44:11|00:00:00.000|           - Configuring CM Systems Management Container                                                                        18:58:58|03:44:17|00:00:06.079|             - .....
18:59:31|03:44:50|00:00:39.295|             - Activity done
18:59:31|03:44:50|00:00:00.000|           - Installing ADK
18:59:43|03:45:01|00:00:11.453|             - ......................
19:03:06|03:48:25|00:03:34.893|             - Activity done
19:03:06|03:48:25|00:00:00.000|           - Installing WinPE
19:03:18|03:48:36|00:00:11.309|             - .....................................................................
19:14:41|04:00:00|00:11:34.820|             - Activity done
19:14:41|04:00:00|00:00:00.000|           - Installing WSUS
19:15:34|04:00:53|00:00:53.015|             - .................................................................................................................
19:54:35|04:39:53|00:39:53.672|             - Activity done
19:54:35|04:39:53|00:00:00.000|           - Running WSUS post configuration tasks
19:54:44|04:40:02|00:00:08.932|             - ................
19:57:05|04:42:24|00:02:30.682|             - Activity done
19:57:05|04:42:24|00:00:00.000|           - Installing additional features (1/2)
19:57:40|04:42:59|00:00:34.567|             - ..........................................
20:04:23|04:49:42|00:07:17.496|             - Activity done
20:04:23|04:49:42|00:00:00.000|           - Installing additional features (2/2)
20:04:55|04:50:13|00:00:31.780|             - .......................................
20:11:12|04:56:31|00:06:49.040|             - Activity done
20:11:12|04:56:31|00:00:00.000|           - Restarting server
20:12:13|04:57:32|00:01:01.066|             - ................................
20:21:01|05:06:19|00:09:48.811|             - Activity done
20:21:01|05:06:19|00:00:00.000|           - Installing Configuration Manager
20:21:31|05:06:49|00:00:29.976|             - ........................................................................................
20:36:02|05:21:20|00:15:00.796|             - Failed to install Configuration Manager (Incorrect function)
Exception: E:\LabSources\CustomRoles\CM-2103\Invoke-InstallCM.ps1:640
Line |
 640 |          throw $ReceiveJobErr
     |          ~~~~~~~~~~~~~~~~~~~~
     | System.Management.Automation.ActionPreferenceStopException: The running command stopped because the preference variable
     | "ErrorActionPreference" or common parameter is set to Stop: Incorrect function    at
     | System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception)    at
     | System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame)    at
     | System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)    at
     | System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)

[20:36:02][05:21:21] C:\Dev\PoSH\AutomatedLab>

I have tried multiple times, with same error. is there something wrong that I'm doing or a bug in the code?

codaamok commented 3 years ago

What does ConfigMgrSetup.log say? It's at the root of C:.

DrummerViking commented 3 years ago

somehow its failing to connect locally. this is the output:

INFO: SQL Connection failed. Connection: LAB1CM01.ONPREM.LAB MASTER, Type: Unsecure  $$<Configuration Manager Setup><06-11-2021 20:33:06.376+180><thread=3292 (0xCDC)>
*** [08001][2][Microsoft][SQL Server Native Client 11.0]Named Pipes Provider: Could not open a connection to SQL Server [2].   $$<Configuration Manager Setup><06-11-2021 20:34:10.942+180><thread=3292 (0xCDC)>
*** [HYT00][0][Microsoft][SQL Server Native Client 11.0]Login timeout expired  $$<Configuration Manager Setup><06-11-2021 20:34:10.942+180><thread=3292 (0xCDC)>
*** [08001][2][Microsoft][SQL Server Native Client 11.0]A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online.  $$<Configuration Manager Setup><06-11-2021 20:34:10.942+180><thread=3292 (0xCDC)>
*** Failed to connect to the SQL Server, connection type: LAB1CM01.ONPREM.LAB MASTER.  $$<Configuration Manager Setup><06-11-2021 20:34:10.942+180><thread=3292 (0xCDC)>
INFO: SQL Connection failed. Connection: LAB1CM01.ONPREM.LAB MASTER, Type: Unsecure  $$<Configuration Manager Setup><06-11-2021 20:34:10.942+180><thread=3292 (0xCDC)>
*** [08001][2][Microsoft][SQL Server Native Client 11.0]Named Pipes Provider: Could not open a connection to SQL Server [2].   $$<Configuration Manager Setup><06-11-2021 20:35:15.718+180><thread=3292 (0xCDC)>
*** [HYT00][0][Microsoft][SQL Server Native Client 11.0]Login timeout expired  $$<Configuration Manager Setup><06-11-2021 20:35:15.718+180><thread=3292 (0xCDC)>
*** [08001][2][Microsoft][SQL Server Native Client 11.0]A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online.  $$<Configuration Manager Setup><06-11-2021 20:35:15.718+180><thread=3292 (0xCDC)>
*** Failed to connect to the SQL Server, connection type: LAB1CM01.ONPREM.LAB MASTER.  $$<Configuration Manager Setup><06-11-2021 20:35:15.718+180><thread=3292 (0xCDC)>
INFO: SQL Connection failed. Connection: LAB1CM01.ONPREM.LAB MASTER, Type: Unsecure  $$<Configuration Manager Setup><06-11-2021 20:35:15.718+180><thread=3292 (0xCDC)>
ERROR: SQL Connection failed. Connection: LAB1CM01.ONPREM.LAB MASTER, Type: Unsecure  $$<Configuration Manager Setup><06-11-2021 20:35:18.762+180><thread=3292 (0xCDC)>
ERROR: Failed to connect SQL Server 'master' db.  $$<Configuration Manager Setup><06-11-2021 20:35:18.821+180><thread=3292 (0xCDC)>
ERROR: Failed to connect to SQL Server lab1cm01.onprem.lab to determine if it is a cluster, or failed to run the query.  $$<Configuration Manager Setup><06-11-2021 20:35:18.864+180><thread=3292 (0xCDC)>
~Could not connect or execute SQL query.  $$<Configuration Manager Setup><06-11-2021 20:35:18.958+180><thread=3292 (0xCDC)>
~~===================== Failed Configuration Manager Server Setup =====================  $$<Configuration Manager Setup><06-11-2021 20:35:18.989+180><thread=3292 (0xCDC)>
<06-11-2021 20:35:32> Failed to create process of SetupWpf.exe. return value 1
codaamok commented 3 years ago

Can you share the complete output from your AutomatedLab run? Also, what version of AutomatedLab are you running?

DrummerViking commented 3 years ago

i'm running automatedlab v5.37 in PS 7.1.3 i recently cloned from your repository the sccm files and custom roles.

I already closed the whole output. i can rebuild and let you know, it has failed the last 4 times, i'm pretty sure will fail again

codaamok commented 3 years ago

You could run this and share the archive with me: New-PSFSupportPackage -Include All

I think it contains personal information, i.e. hostnames and/or IPs.

DrummerViking commented 3 years ago

i have the PSFSupportPackage. is there any private way to send it to you?

codaamok commented 3 years ago

I received your email, thanks.

Could you try using an external Hyper-V switch, that is attached to a physical NIC with network connectivity? I suspect it might be something to do with using the default switch. I didn't add this capability and truthfully, I never really tested it.

DrummerViking commented 3 years ago

issue got resolve. still using it in the "default switch" network. issue I believe was timeouts, or long waiting times on disk. I was using an external USB 3.0 drive (I expected to be slow, but not to affect like this). I tested to install in the local SSD, and the deploy finished with no errors.