I was running Add-WindowsFeature RSAT-AD-PowerShell on a bunch of 2008 R2 servers today and two of them threw the following error:
“Add-WindowsFeature : A configuration started by Contoso\UserA is currently in progress. Before you can start a configuration, Contoso\UserA must log in to complete the current configuration or the configuration in progress must be cancelled.”
Get-WindowsFeature failed with the same error.
Finding out who UserA was, what they were trying to configure, or getting them to log in and do something was not practical. Restarting the servers did not help.
A quick Google told me that if I went into Server Manager and kicked off the Add Function wizard manually, I would get a check box to cancel the pending configuration. So I manually canceled the pending configurations and completed my install.
I would like to make my scripts able to handle this particular error. Does anyone know a way to use PowerShell in such a situation to find out what is pending and to cancel the pending operation?