Microsoft365DSC icon indicating copy to clipboard operation
Microsoft365DSC copied to clipboard

Error when running Start-DscConfiguration

Open JeffS85 opened this issue 1 year ago • 43 comments

### Tasks

JeffS85 avatar Jan 22 '24 18:01 JeffS85

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.

JeffS85 avatar Jan 22 '24 18:01 JeffS85

We will need more details. Can you share the error and the redacted configuration used?

NikCharlebois avatar Jan 22 '24 20:01 NikCharlebois

Error log attached ErrorLog.txt

Rob-Davita avatar Jan 22 '24 21:01 Rob-Davita

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.

ricmestre avatar Jan 22 '24 21:01 ricmestre

Please run Uninstall-Module PSDesiredStateConfiguration to remove the DSC module that is causing the issues in PS 5.1.

andikrueger avatar Jan 25 '24 12:01 andikrueger

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
    

BenG0uld avatar Jan 25 '24 13:01 BenG0uld

Could you please share the top of you configuration? It looks like the Node Element of your configuration is not properly set.

andikrueger avatar Jan 25 '24 13:01 andikrueger

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/

BenG0uld avatar Jan 25 '24 13:01 BenG0uld

Thanks for the addtional context. Could you please verify if there is an configuration (.mof file) within the specified folder: c:\temp\

andikrueger avatar Jan 25 '24 13:01 andikrueger

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

ricmestre avatar Jan 25 '24 13:01 ricmestre

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.

ricmestre avatar Jan 25 '24 13:01 ricmestre

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?

BenG0uld avatar Jan 25 '24 14:01 BenG0uld

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.

andikrueger avatar Jan 25 '24 15:01 andikrueger

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.

BenG0uld avatar Jan 25 '24 17:01 BenG0uld

Please run winrm quickconfig in an elevated PowerShell session.

andikrueger avatar Jan 29 '24 14:01 andikrueger

Complete

BenG0uld avatar Jan 29 '24 14:01 BenG0uld

For API permissions this is the access that I was just granted. Should this be sufficient? MSGraph Permissions

BenG0uld avatar Jan 29 '24 19:01 BenG0uld

Hello, Is there an update on how to proceed?

BenG0uld avatar Feb 06 '24 12:02 BenG0uld

Have you tried starting Start-DSCConfiguration again?

andikrueger avatar Feb 06 '24 12:02 andikrueger

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

BenG0uld avatar Feb 06 '24 13:02 BenG0uld

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

andikrueger avatar Feb 06 '24 13:02 andikrueger

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:

BenG0uld avatar Feb 06 '24 13:02 BenG0uld

Did you set the envelope size to 10MB as recommended?

andikrueger avatar Feb 07 '24 19:02 andikrueger

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.

BenG0uld avatar Feb 07 '24 19:02 BenG0uld

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 avatar Feb 09 '24 16:02 Rob-Davita

@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

andikrueger avatar Feb 09 '24 16:02 andikrueger

As Ben stated above, he is getting a file path not found error when running that.

Rob-Davita avatar Feb 09 '24 16:02 Rob-Davita

Within PS 5 and as local admin and within an elevated PS?

andikrueger avatar Feb 09 '24 17:02 andikrueger

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
    

BenG0uld avatar Feb 09 '24 17:02 BenG0uld