Microsoft365DSC
Microsoft365DSC copied to clipboard
Error when running Start-DscConfiguration
### Tasks
Receiving an error when trying to import our snapshot to a new tenant: Start-DscConfiguration: The computer name was not specified and the configuration directory does not have any configuration files.
We will need more details. Can you share the error and the redacted configuration used?
Error log attached ErrorLog.txt
Lots of problems here, you're using PS7 instead of PS5 (see https://microsoft365dsc.com/user-guide/get-started/powershell7-support/), you have multiple versions of M365DSC installed so there's lots of "This class was already defined" errors and you can't call Start-DscConfiguration since the MOF file was actually not compiled due to errors previously mentioned.
Please run Uninstall-Module PSDesiredStateConfiguration to remove the DSC module that is causing the issues in PS 5.1.
Got one step further and got this error:
PS C:\Temp> Start-DscConfiguration -Path C:\temp -Wait -Verbose Start-DscConfiguration : The computer name was not specified and the configuration directory does not have any configuration files. At line:1 char:1
- Start-DscConfiguration -Path C:\temp -Wait -Verbose
-
+ CategoryInfo : NotSpecified: (:) [Start-DscConfiguration], ArgumentException + FullyQualifiedErrorId : System.ArgumentException,Microsoft.PowerShell.DesiredStateConfiguration.Commands.StartDs cConfigurationCommand
Could you please share the top of you configuration? It looks like the Node Element of your configuration is not properly set.
Here is the entire PS session:
PS C:\temp> Uninstall-Module PSDesiredStateConfiguration PS C:\temp> $SourceCredential = Get-Credential
cmdlet Get-Credential at command pipeline position 1 Supply values for the following parameters: Credential PS C:\temp> Update-M365DSCAllowedGraphScopes -ResourceNameList @("Intune") -Type Read File settings.json was not found for resource {Intune} Allowed Graph scopes updated! PS C:\temp> Export-M365DSCConfiguration -Components @("Intune") -Credential $SourceCredential Exporting Microsoft 365 configuration for Components: Intune
Authentication methods specified:
- Credentials
⌛ Export took {1 seconds}
Destination Path: C:\temp PS C:\temp> $TargetCredential = Get-Credential
cmdlet Get-Credential at command pipeline position 1 Supply values for the following parameters: Credential PS C:\temp> Update-M365DSCAllowedGraphScopes -ResourceNameList @("Intune") -Type Update File settings.json was not found for resource {Intune} Allowed Graph scopes updated! PS C:\temp> .\M365TenantConfig.ps1 -Credential $TargetCredential
PS C:\temp> Start-DscConfiguration -Path C:\temp -Wait -Verbose Start-DscConfiguration : The computer name was not specified and the configuration directory does not have any configuration files. At line:1 char:1
- Start-DscConfiguration -Path C:\temp -Wait -Verbose
-
+ CategoryInfo : NotSpecified: (:) [Start-DscConfiguration], ArgumentException + FullyQualifiedErrorId : System.ArgumentException,Microsoft.PowerShell.DesiredStateConfiguration.Commands.StartDs cConfigurationCommand
We are using this link as a guide for the commands: https://microsoft365dsc.com/user-guide/get-started/cloning-tenants/
Thanks for the addtional context. Could you please verify if there is an configuration (.mof file) within the specified folder: c:\temp\
The export is not creating the blueprint since the command given in the prompt is incorrect, see below, there aren't any components called Intune, if all need to be exported you need to instead use parameter -Workloads INTUNE instead of Components
Export-M365DSCConfiguration -Components @("Intune") -Credential $SourceCredential
About a year ago I added a condition to bailout if no components were found to be extracted, but @ykuijs made a revamp there to select the most secure authentication methods and that chunk was lost.
Getting these errors: [47/70] Extracting [IntuneDeviceConfigurationWiredNetworkPolicyWindows10] using {Credentials}... 🟡 The current tenant is not registered for Intune. [48/70] Extracting [IntuneDeviceEnrollmentLimitRestriction] using {Credentials}...❌ Error Log created at {file://C:/Temp/Ben/9288-M365DSC-ErrorLog.log} [49/70] Extracting [IntuneDeviceEnrollmentPlatformRestriction] using {Credentials}...❌ Error Log created at {file://C:/Temp/Ben/9288-M365DSC-ErrorLog.log}
So, I'm running the command against EXO and getting results. How do I register Intune? Is there a commandlet?
Could you share the list of API permissions of your M365 DSC Application within your tenant? Your command to set the permissions for your M365 DSC Application does not run successfully. You need either to list all resources - Intune is a workload and not a resource.
PS C:\Temp> Start-DscConfiguration -Path C:\temp\M365TenantConfig -Wait -Verbose VERBOSE: Perform operation 'Invoke CimMethod' with following parameters, ''methodName' = SendConfigurationApply,'className' = MSFT_DSCLocalConfigurationManager,'namespaceName' = root/Microsoft/Windows/DesiredStateConfiguration'. The client cannot connect to the destination specified in the request. Verify that the service on the destination is running and is accepting requests. Consult the logs and documentation for the WS-Management service running on the destination, most commonly IIS or WinRM. If the destination is the WinRM service, run the following command on the destination to analyze and configure the WinRM service: "winrm quickconfig". + CategoryInfo : ConnectionError: (root/Microsoft/...gurationManager:String) [], CimException + FullyQualifiedErrorId : HRESULT 0x80338012 + PSComputerName : localhost
VERBOSE: Operation 'Invoke CimMethod' complete. VERBOSE: Time taken for configuration job to complete is 23.904 seconds
Switched gears to EXO and this is the error we got when running that last command.
Please run winrm quickconfig
in an elevated PowerShell session.
Complete
For API permissions this is the access that I was just granted. Should this be sufficient?
Hello, Is there an update on how to proceed?
Have you tried starting Start-DSCConfiguration again?
Start-DscConfiguration -Path C:\temp\M365TenantConfig -Wait -Verbose VERBOSE: Perform operation 'Invoke CimMethod' with following parameters, ''methodName' = SendConfigurationApply,'className' = MSFT_DSCLocalConfigurationManager,'namespaceName' = root/Microsoft/Windows/DesiredStateConfiguration'. The WinRM client sent a request to the remote WS-Management service and was notified that the request size exceeded the configured MaxEnvelopeSize quota. + CategoryInfo : LimitsExceeded: (root/Microsoft/...gurationManager:String) [], CimException + FullyQualifiedErrorId : HRESULT 0x80338111 + PSComputerName : localhost
VERBOSE: Operation 'Invoke CimMethod' complete. VERBOSE: Time taken for configuration job to complete is 6.19 seconds
There is the following recommendation:
We recommend increasing the MaxEnvelopeSize of the agent's WinRM to a minimum of 10 Mb. To make the change, run: Set-Item -Path WSMan:\localhost\MaxEnvelopeSizekb -Value 10240
You could additionally run Test-M365DSCAgent
Test-M365DSCAgent Get-Item : Cannot find drive. A drive with the name 'WSMan' does not exist. At C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.24.117.1\modules\M365DSCAgent.psm1:57 char:32
- ... elopeSize = (Get-Item -Path WSMan:\localhost\MaxEnvelopeSizekb).Value
-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- CategoryInfo : ObjectNotFound: (WSMan:String) [Get-Item], DriveNotFoundException
- FullyQualifiedErrorId : DriveNotFound,Microsoft.PowerShell.Commands.GetItemCommand
The following recommendations were issued. We strongly recommend adressing those:
Did you set the envelope size to 10MB as recommended?
I got an error that the file path could be found. Would it be possible to have a working session to go through the steps together in real-time so we can address the errors as they come up? It seems like with every issue addressed, a new error comes up.
Hi all. We are getting a ton of pressure to get our test environment stood up as we have some custom development work that needs to be done. Any help we can get is greatly appreciated
@Rob-Davita were you able to run a configuration with the change to the max envelope size?
Set-Item -Path WSMan:\localhost\MaxEnvelopeSizekb -Value 10240
As Ben stated above, he is getting a file path not found error when running that.
Within PS 5 and as local admin and within an elevated PS?
Yes. PS 5, local admin, and admin PS:
Set-Item -Path WSMan:\localhost\MaxEnvelopeSizekb -Value 10240 Set-Item : Cannot find drive. A drive with the name 'WSMan' does not exist. At line:1 char:1
- Set-Item -Path WSMan:\localhost\MaxEnvelopeSizekb -Value 10240
-
+ CategoryInfo : ObjectNotFound: (WSMan:String) [Set-Item], DriveNotFoundException + FullyQualifiedErrorId : DriveNotFound,Microsoft.PowerShell.Commands.SetItemCommand