After installing the latest PowerShell Daily build (daily20230225.2) I am unable to import the ActiveDirectory module
Module should import with no error.
Import-Module: Attempting to perform the InitializeDefaultDrives operation on the 'ActiveDirectory' provider failed.
Import-Module: Attempting to perform the InitializeDefaultDrives operation on the 'ActiveDirectory' provider failed.
PS C:\Users\wojang> Get-Error
Exception :
Type : System.Management.Automation.ProviderInvocationException
ProviderInfo : Microsoft.ActiveDirectory.Management\ActiveDirectory
ErrorRecord :
Exception :
Type : System.TypeInitializationException
TypeName : System.ServiceModel.Diagnostics.TraceUtility
TargetSite :
Name : SetEtwProviderId
DeclaringType : System.ServiceModel.Diagnostics.TraceUtility, System.ServiceModel, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089
MemberType : Method
Module : System.ServiceModel.dll
Message : The type initializer for 'System.ServiceModel.Diagnostics.TraceUtility' threw an exception.
InnerException :
Type : System.Configuration.ConfigurationErrorsException
Message : The 'system.serviceModel/diagnostics' configuration section cannot be created. The machine.config file is missing
information. Verify that this configuration section is properly registered and that you have correctly spelled the section name. For Windows
Communication Foundation sections, run ServiceModelReg.exe -i to fix this error.
Errors :
Type : System.Configuration.ConfigurationErrorsException
Message : The 'system.serviceModel/diagnostics' configuration section cannot be created. The machine.config file is
missing information. Verify that this configuration section is properly registered and that you have correctly spelled the section name. For
Windows Communication Foundation sections, run ServiceModelReg.exe -i to fix this error.
Errors :
Type : System.Configuration.ConfigurationErrorsException
Message : The 'system.serviceModel/diagnostics' configuration section cannot be created. The machine.config file is
missing information. Verify that this configuration section is properly registered and that you have correctly spelled the section name. For
Windows Communication Foundation sections, run ServiceModelReg.exe -i to fix this error.
Errors :
Type : System.Configuration.ConfigurationErrorsException
Message : The 'system.serviceModel/diagnostics' configuration section cannot be created. The machine.config file
is missing information. Verify that this configuration section is properly registered and that you have correctly spelled the section name. For
Windows Communication Foundation sections, run ServiceModelReg.exe -i to fix this error.
Errors :
Type : System.Configuration.ConfigurationErrorsException
Message : The 'system.serviceModel/diagnostics' configuration section cannot be created. The machine.config
file is missing information. Verify that this configuration section is properly registered and that you have correctly spelled the section name.
For Windows Communication Foundation sections, run ServiceModelReg.exe -i to fix this error.
Errors :
Type : System.Configuration.ConfigurationErrorsException
Message : The 'system.serviceModel/diagnostics' configuration section cannot be created. The
machine.config file is missing information. Verify that this configuration section is properly registered and that you have correctly spelled the
section name. For Windows Communication Foundation sections, run ServiceModelReg.exe -i to fix this error.
Errors : …
BareMessage : The 'system.serviceModel/diagnostics' configuration section cannot be created. The
machine.config file is missing information. Verify that this configuration section is properly registered and that you have correctly spelled the
section name. For Windows Communication Foundation sections, run ServiceModelReg.exe -i to fix this error.
HResult : -2146232062
BareMessage : The 'system.serviceModel/diagnostics' configuration section cannot be created. The machine.config
file is missing information. Verify that this configuration section is properly registered and that you have correctly spelled the section name.
For Windows Communication Foundation sections, run ServiceModelReg.exe -i to fix this error.
HResult : -2146232062
BareMessage : The 'system.serviceModel/diagnostics' configuration section cannot be created. The machine.config file
is missing information. Verify that this configuration section is properly registered and that you have correctly spelled the section name. For
Windows Communication Foundation sections, run ServiceModelReg.exe -i to fix this error.
HResult : -2146232062
BareMessage : The 'system.serviceModel/diagnostics' configuration section cannot be created. The machine.config file is
missing information. Verify that this configuration section is properly registered and that you have correctly spelled the section name. For
Windows Communication Foundation sections, run ServiceModelReg.exe -i to fix this error.
HResult : -2146232062
BareMessage : The 'system.serviceModel/diagnostics' configuration section cannot be created. The machine.config file is
missing information. Verify that this configuration section is properly registered and that you have correctly spelled the section name. For
Windows Communication Foundation sections, run ServiceModelReg.exe -i to fix this error.
HResult : -2146232062
BareMessage : The 'system.serviceModel/diagnostics' configuration section cannot be created. The machine.config file is missing
information. Verify that this configuration section is properly registered and that you have correctly spelled the section name. For Windows
Communication Foundation sections, run ServiceModelReg.exe -i to fix this error.
TargetSite :
Name : UnsafeGetSectionNoTrace
DeclaringType : System.ServiceModel.Configuration.ConfigurationHelpers, System.ServiceModel, Version=4.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089
MemberType : Method
Module : System.ServiceModel.dll
Source : System.ServiceModel
HResult : -2146232062
StackTrace :
at System.ServiceModel.Configuration.ConfigurationHelpers.UnsafeGetSectionNoTrace(String sectionPath)
at System.ServiceModel.Configuration.DiagnosticSection.UnsafeGetSectionNoTrace()
at System.ServiceModel.Diagnostics.TraceUtility.SetEtwProviderId()
at System.ServiceModel.Diagnostics.TraceUtility..cctor()
Source : System.ServiceModel
HResult : -2146233036
StackTrace :
at System.ServiceModel.Diagnostics.TraceUtility.SetEtwProviderId()
at System.ServiceModel.ChannelFactory..ctor()
at System.ServiceModel.ChannelFactory`1..ctor(Type channelType)
at System.ServiceModel.ChannelFactory`1..ctor(Binding binding, EndpointAddress remoteAddress)
at Microsoft.ActiveDirectory.Management.AdwsConnection.InitializeChannel[TChannel](TChannel& channel, ChannelFactory`1& chFactory, String
endpointName, CommunicationException& commException)
at Microsoft.ActiveDirectory.Management.AdwsConnection.SearchAnObject(ADSearchRequest request)
at Microsoft.ActiveDirectory.Management.AdwsConnection.Search(ADSearchRequest request)
at Microsoft.ActiveDirectory.Management.ADWebServiceStoreAccess.Microsoft.ActiveDirectory.Management.IADSyncOperations.Search(ADSessionHandle
handle, ADSearchRequest request)
at Microsoft.ActiveDirectory.Management.ADObjectSearcher.GetRootDSE(ICollection`1 propertyList, Boolean propertyNamesOnly)
at Microsoft.ActiveDirectory.Management.ADObjectSearcher.GetRootDSE(ICollection`1 propertyList)
at Microsoft.ActiveDirectory.Management.Provider.ADProvider.GetRootDSE(ADSessionInfo sessionInfo, ICollection`1 propertiesToRetrieve)
at Microsoft.ActiveDirectory.Management.Provider.ADProvider.GetRootDSE(ADSessionInfo sessionInfo)
at Microsoft.ActiveDirectory.Management.Provider.ADProvider.InitializeDefaultDrives()
at System.Management.Automation.SessionStateInternal.InitializeProvider(CmdletProvider providerInstance, ProviderInfo provider,
CmdletProviderContext context)
CategoryInfo : InvalidOperation: (:) [], TypeInitializationException
FullyQualifiedErrorId : InitializeDefaultDrivesException
Message : Attempting to perform the InitializeDefaultDrives operation on the 'ActiveDirectory' provider failed.
InnerException :
Type : System.TypeInitializationException
TypeName : System.ServiceModel.Diagnostics.TraceUtility
TargetSite :
Name : SetEtwProviderId
DeclaringType : System.ServiceModel.Diagnostics.TraceUtility, System.ServiceModel, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089
MemberType : Method
Module : System.ServiceModel.dll
Message : The type initializer for 'System.ServiceModel.Diagnostics.TraceUtility' threw an exception.
InnerException :
Type : System.Configuration.ConfigurationErrorsException
Message : The 'system.serviceModel/diagnostics' configuration section cannot be created. The machine.config file is missing
information. Verify that this configuration section is properly registered and that you have correctly spelled the section name. For Windows
Communication Foundation sections, run ServiceModelReg.exe -i to fix this error.
Errors :
Type : System.Configuration.ConfigurationErrorsException
Message : The 'system.serviceModel/diagnostics' configuration section cannot be created. The machine.config file is missing
information. Verify that this configuration section is properly registered and that you have correctly spelled the section name. For Windows
Communication Foundation sections, run ServiceModelReg.exe -i to fix this error.
Errors :
Type : System.Configuration.ConfigurationErrorsException
Message : The 'system.serviceModel/diagnostics' configuration section cannot be created. The machine.config file is
missing information. Verify that this configuration section is properly registered and that you have correctly spelled the section name. For
Windows Communication Foundation sections, run ServiceModelReg.exe -i to fix this error.
Errors :
Type : System.Configuration.ConfigurationErrorsException
Message : The 'system.serviceModel/diagnostics' configuration section cannot be created. The machine.config file is
missing information. Verify that this configuration section is properly registered and that you have correctly spelled the section name. For
Windows Communication Foundation sections, run ServiceModelReg.exe -i to fix this error.
Errors :
Type : System.Configuration.ConfigurationErrorsException
Message : The 'system.serviceModel/diagnostics' configuration section cannot be created. The machine.config file
is missing information. Verify that this configuration section is properly registered and that you have correctly spelled the section name. For
Windows Communication Foundation sections, run ServiceModelReg.exe -i to fix this error.
Errors :
Type : System.Configuration.ConfigurationErrorsException
Message : The 'system.serviceModel/diagnostics' configuration section cannot be created. The machine.config
file is missing information. Verify that this configuration section is properly registered and that you have correctly spelled the section name.
For Windows Communication Foundation sections, run ServiceModelReg.exe -i to fix this error.
Errors :
Type : System.Configuration.ConfigurationErrorsException
Message : The 'system.serviceModel/diagnostics' configuration section cannot be created. The
machine.config file is missing information. Verify that this configuration section is properly registered and that you have correctly spelled the
section name. For Windows Communication Foundation sections, run ServiceModelReg.exe -i to fix this error.
Errors : …
BareMessage : The 'system.serviceModel/diagnostics' configuration section cannot be created. The
machine.config file is missing information. Verify that this configuration section is properly registered and that you have correctly spelled the
section name. For Windows Communication Foundation sections, run ServiceModelReg.exe -i to fix this error.
HResult : -2146232062
BareMessage : The 'system.serviceModel/diagnostics' configuration section cannot be created. The machine.config
file is missing information. Verify that this configuration section is properly registered and that you have correctly spelled the section name.
For Windows Communication Foundation sections, run ServiceModelReg.exe -i to fix this error.
HResult : -2146232062
BareMessage : The 'system.serviceModel/diagnostics' configuration section cannot be created. The machine.config file
is missing information. Verify that this configuration section is properly registered and that you have correctly spelled the section name. For
Windows Communication Foundation sections, run ServiceModelReg.exe -i to fix this error.
HResult : -2146232062
BareMessage : The 'system.serviceModel/diagnostics' configuration section cannot be created. The machine.config file is
missing information. Verify that this configuration section is properly registered and that you have correctly spelled the section name. For
Windows Communication Foundation sections, run ServiceModelReg.exe -i to fix this error.
HResult : -2146232062
BareMessage : The 'system.serviceModel/diagnostics' configuration section cannot be created. The machine.config file is
missing information. Verify that this configuration section is properly registered and that you have correctly spelled the section name. For
Windows Communication Foundation sections, run ServiceModelReg.exe -i to fix this error.
HResult : -2146232062
BareMessage : The 'system.serviceModel/diagnostics' configuration section cannot be created. The machine.config file is missing
information. Verify that this configuration section is properly registered and that you have correctly spelled the section name. For Windows
Communication Foundation sections, run ServiceModelReg.exe -i to fix this error.
HResult : -2146232062
BareMessage : The 'system.serviceModel/diagnostics' configuration section cannot be created. The machine.config file is missing
information. Verify that this configuration section is properly registered and that you have correctly spelled the section name. For Windows
Communication Foundation sections, run ServiceModelReg.exe -i to fix this error.
TargetSite :
Name : UnsafeGetSectionNoTrace
DeclaringType : System.ServiceModel.Configuration.ConfigurationHelpers, System.ServiceModel, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089
MemberType : Method
Module : System.ServiceModel.dll
Source : System.ServiceModel
HResult : -2146232062
StackTrace :
at System.ServiceModel.Configuration.ConfigurationHelpers.UnsafeGetSectionNoTrace(String sectionPath)
at System.ServiceModel.Configuration.DiagnosticSection.UnsafeGetSectionNoTrace()
at System.ServiceModel.Diagnostics.TraceUtility.SetEtwProviderId()
at System.ServiceModel.Diagnostics.TraceUtility..cctor()
Source : System.ServiceModel
HResult : -2146233036
StackTrace :
at System.ServiceModel.Diagnostics.TraceUtility.SetEtwProviderId()
at System.ServiceModel.ChannelFactory..ctor()
at System.ServiceModel.ChannelFactory`1..ctor(Type channelType)
at System.ServiceModel.ChannelFactory`1..ctor(Binding binding, EndpointAddress remoteAddress)
at Microsoft.ActiveDirectory.Management.AdwsConnection.InitializeChannel[TChannel](TChannel& channel, ChannelFactory`1& chFactory, String
endpointName, CommunicationException& commException)
at Microsoft.ActiveDirectory.Management.AdwsConnection.SearchAnObject(ADSearchRequest request)
at Microsoft.ActiveDirectory.Management.AdwsConnection.Search(ADSearchRequest request)
at Microsoft.ActiveDirectory.Management.ADWebServiceStoreAccess.Microsoft.ActiveDirectory.Management.IADSyncOperations.Search(ADSessionHandle
handle, ADSearchRequest request)
at Microsoft.ActiveDirectory.Management.ADObjectSearcher.GetRootDSE(ICollection`1 propertyList, Boolean propertyNamesOnly)
at Microsoft.ActiveDirectory.Management.ADObjectSearcher.GetRootDSE(ICollection`1 propertyList)
at Microsoft.ActiveDirectory.Management.Provider.ADProvider.GetRootDSE(ADSessionInfo sessionInfo, ICollection`1 propertiesToRetrieve)
at Microsoft.ActiveDirectory.Management.Provider.ADProvider.GetRootDSE(ADSessionInfo sessionInfo)
at Microsoft.ActiveDirectory.Management.Provider.ADProvider.InitializeDefaultDrives()
at System.Management.Automation.SessionStateInternal.InitializeProvider(CmdletProvider providerInstance, ProviderInfo provider,
CmdletProviderContext context)
HResult : -2146233087
TargetObject : Microsoft.ActiveDirectory.Management\ActiveDirectory
CategoryInfo : InvalidOperation: (Microsoft.ActiveDir…ent\ActiveDirectory:ProviderInfo) [Import-Module], ProviderInvocationException
FullyQualifiedErrorId : InitializeDefaultDrivesException,Microsoft.PowerShell.Commands.ImportModuleCommand
InvocationInfo :
MyCommand : Import-Module
ScriptLineNumber : 1
OffsetInLine : 1
HistoryId : 1
Line : import-Module ActiveDirectory
PositionMessage : At line:1 char:1
+ import-Module ActiveDirectory
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
InvocationName : import-Module
CommandOrigin : Internal
ScriptStackTrace : at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo :
Prerequisites
Steps to reproduce
After installing the latest PowerShell Daily build (daily20230225.2) I am unable to import the
ActiveDirectorymoduleImport-Module ActiveDirectory[Update by @daxian-dbw] See the investigation and the conclusion at #19238 (comment) and #19238 (comment)
Expected behavior
Module should import with no error.Actual behavior
Import-Module: Attempting to perform the InitializeDefaultDrives operation on the 'ActiveDirectory' provider failed.Error details
Environment data
Visuals
No response