Esri / arcgis-powershell-dsc

This repository contains scripts, code and samples for automating the install and configuration of ArcGIS (Enterprise and Desktop) using Microsoft Windows PowerShell DSC (Desired State Configuration).
Apache License 2.0
114 stars 62 forks source link

Can't kill DSC Configuration process at the server #245

Closed ludmilabogucharska closed 4 years ago

ludmilabogucharska commented 4 years ago

Hello, I am having troruble to remove hanging DSC Configuration process from the server. It started when I tried to run upgrade process for ArcGIS License Server and Desktop using Powershell commands, on disconnected server. I installed NuGet and ArcGIS module by copying them from connected machine: PS D:> Get-Command -Module ArcGIS

CommandType Name Version Source


Function Get-FQDN 3.0.0 ArcGIS Function Invoke-ArcGISConfiguration 3.0.0 ArcGIS Function Invoke-BuildArcGISAzureImage 3.0.0 ArcGIS Function Invoke-PublishWebApp 3.0.0 ArcGIS

But when I tried to run "Invoke-ArcGISConfiguration ...." process, it hangs indefinitely. Now I am trying to stop the process, but it does not work as well.

I tried following command, but it is hanging: PS D:> Stop-DscConfiguration –Force

After the server reboot, I tried this command, which produces some message, but also hangs:

PS D:> Remove-DscConfigurationDocument -Stage Current,Pending -Force –Verbose VERBOSE: An LCM method call arrived from computer MSSEMPAPVWDV01 with user sid S-1-5-21-4258890176-1816793054-651103780-16727. VERBOSE: The -Force option was specified with the Stop operation. The current configuration has been successfully

However, this message is misleading. The command line was never returned (process hangs), and the DSC Configuration process still running:

PS D:> Get-DscLocalConfigurationManager

ActionAfterReboot : ContinueConfiguration AgentId : 3A2AC180-6959-11EA-A319-0050569753DE AllowModuleOverWrite : False CertificateID : ConfigurationDownloadManagers : {} ConfigurationID : ConfigurationMode : ApplyAndMonitor ConfigurationModeFrequencyMins : 15 Credential : DebugMode : {NONE} DownloadManagerCustomData : DownloadManagerName : LCMCompatibleVersions : {1.0, 2.0} LCMState : Busy LCMStateDetail : LCM is performing a consistency check. LCMVersion : 2.0 StatusRetentionTimeInDays : 10 SignatureValidationPolicy : NONE SignatureValidations : {} MaximumDownloadSizeMB : 500 PartialConfigurations : RebootNodeIfNeeded : False RefreshFrequencyMins : 30 RefreshMode : PUSH ReportManagers : {} ResourceModuleManagers : {} PSComputerName :

My question now, how can I kill this process? It continues running even after server reboot. I need to clean the server from it, to be able to proceed with working upgrade solutions (like GIU-based or silent upgrade). But I am afraid that running DSC Config process may cause issues.

Can someone please help with "cleanup" issue?

nshampur commented 4 years ago

try changing on your LCM from ConfigurationMode : ApplyAndMonitor

to ApplyOnly

https://docs.microsoft.com/en-us/powershell/scripting/dsc/managing-nodes/metaconfig?view=powershell-7 https://docs.microsoft.com/en-us/powershell/module/psdesiredstateconfiguration/set-dsclocalconfigurationmanager?view=powershell-5.1

PleaseStopAsking commented 4 years ago

@ludmilabogucharska You could also try using the following. Keep in mind this will clear Everything and caution should be used.

#Remove all mof files (pending,current,backup,MetaConfig.mof,caches,etc)
rm C:\windows\system32\Configuration\*.mof*
#Kill the LCM/DSC processes
gps wmi* | ? {$_.modules.ModuleName -like "*DSC*"} | stop-process -force
ludmilabogucharska commented 4 years ago

@nshampur Sorry, I don't understand how it helps to remove the DSC Configuration process from the server? Can you please explain better why we need it?

Btw I tried to run it, but there's no such parameter in Set-DscLocalConfigurationManager command.

PS H:> $Host.Version

Major Minor Build Revision


5 1 14393 3471

PS H:> Set-DscLocalConfigurationManager -ConfigurationMode ApplyOnly Set-DscLocalConfigurationManager : A parameter cannot be found that matches parameter name 'ConfigurationMode'. At line:1 char:34

ludmilabogucharska commented 4 years ago

@PleaseStopAsking That helped, thank you! I run the shorter version of Get-Processes command at first, just to see what processes are there: PS H:> gps wmi | ? {$_.modules.ModuleName -like "DSC*"}

Handles NPM(K) PM(K) WS(K) CPU(s) Id SI ProcessName


470      24    15500      28360      17.13   2844   0 WmiPrvSE
635      35    64124      34496       4.97   3216   0 WmiPrvSE

I found them in Event Viewer as well, by thier ID, they seem relevant.. Thanks again. I hope I did not kill anything I'm not supposed to..