Closed ritouret closed 3 years ago
Could you execute the powershell directly ? You can get with --ps-display
Please execute it directly to see the result
yes, there is the result :
System.MissingMethodException: Method not found: '!!0[] System.Array.Empty()'. at Microsoft.ConfigurationManagement.PowerShell.Provider.CMDriveProvider.Start(ProviderInfo providerInfo) at System.Management.Automation.SessionStateInternal.NewProvider(ProviderInfo provider)
Could you try to execute following powershell code:
$modulePath = ${env:SMS_ADMIN_UI_PATH}
$modulePath = $modulePath.Substring(0, $modulePath.lastIndexOf("\"))
$module = $modulePath + "\ConfigurationManager.psd1"
Import-Module $module
$providers = Get-PSProvider | Where {$_.Name -match "CMSite" }
PS C:\Windows\system32> $modulePath = ${env:SMS_ADMIN_UIPATH} $modulePath = $modulePath.Substring(0, $modulePath.lastIndexOf("\")) $module = $modulePath + "\ConfigurationManager.psd1" Import-Module $module $providers = Get-PSProvider | Where {$.Name -match "CMSite" }
(pas de message d'erreur)
could you provide the result of:
Get-PsProvider
PS C:\Windows\system32> Get-PsProvider
Name Capabilities Drives
Alias ShouldProcess {Alias}
Environment ShouldProcess {Env}
FileSystem Filter, ShouldProcess, Credentials {C, D, E, F...}
Function ShouldProcess {Function}
Registry ShouldProcess, Transactions {HKLM, HKCU}
Variable ShouldProcess {Variable}
There is no CMSite provider... Is it working for you:
New-PSDrive -Name SCCMDrive -PSProvider "CMSite" -Root $env:COMPUTERNAME -Description "SCCM Site"
Unfortunatly no :
PS C:\Windows\system32> New-PSDrive -Name SCCMDrive -PSProvider "CMSite" -Root $env:COMPUTERNAME -Description "SCCM Site" New-PSDrive : Cannot find a provider with the name 'CMSite'. At line:1 char:1
+ CategoryInfo : ObjectNotFound: (CMSite:String) [New-PSDrive], ProviderNotFoundException
+ FullyQualifiedErrorId : ProviderNotFound,Microsoft.PowerShell.Commands.NewPSDriveCommand
Following is working ?
New-PSDrive -Name SCCMDrive -PSProvider "AdminUI.PS.Provider\CMSite" -Root $env:COMPUTERNAME -Description "SCCM Site"
So i need to set that value if it's empty.
Sorry Quentin, another error :
PS C:\Windows\system32> New-PSDrive -Name SCCMDrive -PSProvider "AdminUI.PS.Provider\CMSite" -Root $env:COMPUTERNAME -Description "SCCM Site"
New-PSDrive : Cannot find a provider with the name 'AdminUI.PS.Provider\CMSite'. At line:1 char:1
+ CategoryInfo : ObjectNotFound: (AdminUI.PS.Provider\CMSite:String) [New-PSDrive], ProviderNotFoundException
+ FullyQualifiedErrorId : ProviderNotFound,Microsoft.PowerShell.Commands.NewPSDriveCommand
It was working before ?
The mode yes, it was working before the upgrade yesterday
I asked to our expert who made the upgrade to ask to Microsoft what happened to this Provider. I'll let you know. Thank you.
It was that line before the patch:
New-PSDrive -Name SCCMDrive -PSProvider "AdminUI.PS.Provider\CMSite" -Root $env:COMPUTERNAME -Description "SCCM Site"
Same Error :
PS C:\Windows\system32> New-PSDrive -Name SCCMDrive -PSProvider "AdminUI.PS.Provider\CMSite" -Root $env:COMPUTERNAME -Description "SCCM Site" New-PSDrive : Cannot find a provider with the name 'AdminUI.PS.Provider\CMSite'. At line:1 char:1
+ CategoryInfo : ObjectNotFound: (AdminUI.PS.Provider\CMSite:String) [New-PSDrive], ProviderNotFoundException
+ FullyQualifiedErrorId : ProviderNotFound,Microsoft.PowerShell.Commands.NewPSDriveCommand
I used a default provider if we don't find with Get-PSProvider. You can test:
$modulePath = ${env:SMS_ADMIN_UI_PATH}
$modulePath = $modulePath.Substring(0, $modulePath.lastIndexOf("\"))
$module = $modulePath + "\ConfigurationManager.psd1"
Import-Module $module
$providers = Get-PSProvider | Where {$_.Name -match "CMSite" }
if ($null -eq $providers -or $providers.Count -eq 0) {
$providers = New-Object System.Collections.Generic.List[Hashtable];
$item = @{}
$item.Name = "AdminUI.PS.Provider\CMSite"
$items.Add($item)
}
Hello Quentin,
I've just tested and here is the result : Import-Module : Method not found: '!!0[] System.Array.Empty()'. At line:4 char:1
+ CategoryInfo : InvalidOperation: (:) [Import-Module], MissingMethodException
+ FullyQualifiedErrorId : ProviderStartException,Microsoft.PowerShell.Commands.ImportModuleCommand
You cannot call a method on a null-valued expression. At line:11 char:9
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
Please test with last version: https://github.com/centreon/centreon-nsclient-build/releases/tag/20210910075442
That's what i've done.
In the meantime, our expert has installed the Microsoft .NET 4.7.2 which is a required by SCCM 2103 for the ConfigurationManager PowerShell module : that was the problem.
It works fine except this new error : https://github.com/centreon/centreon-plugins/issues/3150
Hello,
After last update of SCCM in version 2103, this mode is broken. I've installed the last centreon_plugins.exe 20210902 from today and i have this response now :
Use of uninitialized value in numeric eq (==) at (eval 36) line 1. Use of uninitialized value in numeric eq (==) at (eval 36) line 1. UNKNOWN: Command error: System.MissingMethodException: Method not found: '!!0[] System.Array.Empty()'. - at Microsoft.ConfigurationManagement.PowerShell.Provider.CMDriveProvider.Start(ProviderInfo providerInfo) - at System.Management.Automation.SessionStateInternal.NewProvider(ProviderInfo provider)
I don't know if it's the same cause for this issue : https://github.com/centreon/centreon-plugins/issues/2906 But it's not the same output messages.
Thanks