简体   繁体   中英

PowerShell DSC File Resource causing WBEM error

I'm trying to use a File resource to copy a lot of files, around 20,000 of them spanning 3000 directories. While DSC does work in deploying the files, I run into a problem when I try to test for them. Everything works fine if I have just a few files in the resource, but if I ever load in my full set in that break things. I can get Test-DSCConfiguration on the target node and get a True result (after increasing the memory on my test server from 4 gigs to 16 gigs), but Get-DSCConfiguration throws this error:

Get-DscConfiguration : The WBEM Server limits have been exceeded (eg memory, connections, ...). At line:1 char:1 + Get-DscConfiguration + ~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ResourceBusy: (MSFT_DSCLocalConfigurationManager:root/Microsoft/...gurationManager) [Get -DscConfiguration], CimException + FullyQualifiedErrorId : MI RESULT 27,Get-DscConfiguration

The configuration is simple:

File ServerBox { Ensure = "Present" Type = "Directory" Recurse = $true MatchSource = $true Force = $true Checksum = "modifiedDate" SourcePath = "\\\\DevOps\\ServerBox" DestinationPath = "D:\\ServerBox" }

At first I thought the problem was memory, as I couldn't even get Test-DSCConfiguration to run, but that one threw memory errors, so once I added more to the system I could at least get a True result from the Test. But Get-DSCConfiguration still doesn't function.

Anyone have any insight into the WBEM errors?

Admittedly this is a guess, but I think that Get-DSCConfiguration probably just wasn't tested enough and is hitting some kind of internal limit.

The thing is, Get-DSCResource is not actually used as part DSC (meaning the LCM doesn't call it, PowerShell doesn't use it in generating configs, Start-DSCConfiguration doesn't use it, etc.).

It only ever gets called if you manually invoke it, so in a lot of ways it's just a stub right now.

When I write custom resources I actually try to make Get- useful; usually by making Set- and/or Test- call Get- internally, but it can be a challenge to do so.

For that reason, it's feasible that a given resource will not have been well-tested with Get-DSCConfiguration .

Sorry I don't have any insight into the error itself. The File resource is not a script resource; I think it's actually native compiled code so it's likely only Microsoft can answer this.

You can try increasing the WSMAN session limits. Here is some information on this : http://blogs.msdn.com/b/powershell/archive/2010/05/03/configuring-wsman-limits.aspx

Increase the MaxMemoryPerShellMB to a larger value and then try the same resource.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM