Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when running Start-DscConfiguration #4206

Closed
JeffS85 opened this issue Jan 22, 2024 · 45 comments
Closed

Error when running Start-DscConfiguration #4206

JeffS85 opened this issue Jan 22, 2024 · 45 comments

Comments

@JeffS85
Copy link

JeffS85 commented Jan 22, 2024

Tasks

Preview Give feedback
No tasks being tracked yet.
@JeffS85
Copy link
Author

JeffS85 commented Jan 22, 2024

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.

@NikCharlebois
Copy link
Collaborator

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

@Rob-Davita
Copy link

Error log attached
ErrorLog.txt

@ricmestre
Copy link
Contributor

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.

@BenG0uld
Copy link

PSSessionDSC0124.txt

@andikrueger
Copy link
Collaborator

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

@BenG0uld
Copy link

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
    

@andikrueger
Copy link
Collaborator

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

@BenG0uld
Copy link

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/

@andikrueger
Copy link
Collaborator

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

@ricmestre
Copy link
Contributor

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
Copy link
Contributor

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.

@BenG0uld
Copy link

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?

@andikrueger
Copy link
Collaborator

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.

@BenG0uld
Copy link

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.

@andikrueger
Copy link
Collaborator

Please run winrm quickconfig in an elevated PowerShell session.

@BenG0uld
Copy link

Complete

@BenG0uld
Copy link

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

@BenG0uld
Copy link

BenG0uld commented Feb 6, 2024

Hello,
Is there an update on how to proceed?

@andikrueger
Copy link
Collaborator

Have you tried starting Start-DSCConfiguration again?

@BenG0uld
Copy link

BenG0uld commented Feb 6, 2024

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

@andikrueger
Copy link
Collaborator

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

@BenG0uld
Copy link

BenG0uld commented Feb 6, 2024

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:

@andikrueger
Copy link
Collaborator

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

@BenG0uld
Copy link

BenG0uld commented Feb 7, 2024

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.

@Rob-Davita
Copy link

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

@andikrueger
Copy link
Collaborator

@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

@Rob-Davita
Copy link

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

@andikrueger
Copy link
Collaborator

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

@BenG0uld
Copy link

BenG0uld commented Feb 9, 2024

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
    

@andikrueger
Copy link
Collaborator

Could you share the output of

Get-ComputerInfo -Property @(
'OsName',
'OsOperatingSystemSKU',
'OSArchitecture',
'WindowsVersion',
'WindowsBuildLabEx',
'OsLanguage',
'OsMuiLanguages')

$PSVersionTable

@BenG0uld
Copy link

BenG0uld commented Feb 9, 2024

PS C:\Temp> Get-ComputerInfo -Property @(

'OsName',
'OsOperatingSystemSKU',
'OSArchitecture',
'WindowsVersion',
'WindowsBuildLabEx',
'OsLanguage',
'OsMuiLanguages')

OsName : Microsoft Windows 10 Enterprise
OsOperatingSystemSKU : EnterpriseEdition
OsArchitecture : 64-bit
WindowsVersion : 2009
WindowsBuildLabEx : 19041.1.amd64fre.vb_release.191206-1406
OsLanguage : en-US
OsMuiLanguages : {en-US}

PS C:\Temp> $PSVersionTable

Name Value


PSVersion 5.1.19041.3803
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.19041.3803
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

@andikrueger
Copy link
Collaborator

Could you please verify that the windows remote management (start-service winrm) service is started as well.

@BenG0uld
Copy link

BenG0uld commented Feb 9, 2024

PS C:\Temp> start-service winrm
PS C:\Temp> 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
    

@andikrueger
Copy link
Collaborator

There is something off with your windows 10 box. Could you share the outcome of

get-psdrive

@BenG0uld
Copy link

BenG0uld commented Feb 9, 2024

PS C:\Temp> get-psdrive

Name Used (GB) Free (GB) Provider Root CurrentLocation


Alias Alias
C 68.79 169.07 FileSystem C:\ Temp
Cert Certificate
Env Environment
Function Function
HKCU Registry HKEY_CURRENT_USER
HKLM Registry HKEY_LOCAL_MACHINE
Variable Variable

@andikrueger
Copy link
Collaborator

Please try the following:

winrm invoke Restore winrm/Config
winrm quickconfig

@BenG0uld
Copy link

BenG0uld commented Feb 9, 2024

PS C:\Temp> winrm invoke Restore winrm/Config
Restore_OUTPUT

PS C:\Temp> winrm quickconfig
WinRM service is already running on this machine.
WinRM is not set up to allow remote access to this machine for management.
The following changes must be made:

Create a WinRM listener on HTTP://* to accept WS-Man requests to any IP on this machine.

Make these changes [y/n]? y

WinRM has been updated for remote management.

Created a WinRM listener on HTTP://* to accept WS-Man requests to any IP on this machine.
PS C:\Temp> 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
    

@andikrueger
Copy link
Collaborator

Do you have any chance to use another system and try to run the configuration there. I haven’t seen this kind of issue before.

@BenG0uld
Copy link

BenG0uld commented Feb 9, 2024

From a jump I was able to run the set-item command with no error. I will work with Jeff to start the process from the beginning on the jump server. I will update if we run into any problems.

@BenG0uld
Copy link

Was able to pull the export of the M365 configuration.
When I ran the following command, I got the error below. Any insight?:
PS C:\temp> .\M365TenantConfig.ps1 -Credential $TargetCredential
Write-Error: Invalid MOF definition for node 'localhost': Exception calling
"ValidateInstanceText" with "1" argument(s): "Value of parameter
'serializedBufferLength' must be in the range of 4 and 52428800, but it's value
is 96591698"

Directory: C:\temp\Ben\EXO\M365TenantConfig

Mode LastWriteTime Length Name


-a--- 2/15/2024 11:34 AM 48296013 localhost.mof.error
InvalidOperation: Errors occurred while processing configuration 'M365TenantConfig'.

@andikrueger
Copy link
Collaborator

Could you share details about your configuration? e.g. Number of resource, File Size, number of lines,... Could you search for the value: 96591698 within your configuration?

A while back, we had someone reporting the same issue, but we were not able to investigate: #3249

@BenG0uld
Copy link

Number of lines: 546944
File size: 54,284 KB
Resource: EXO
96591698 not found.

We just need the configuration settings for Exchange. Is there a way to just pull that and bypass objects? The script ran for two days because of 90+ thousand objects that needs to be exported.

@FabienTschanz
Copy link
Collaborator

@BenG0uld I know I'm late, but the issue you mentioned in the last comment is because your exported configuration is too big. You need to reduce the size of the export to make it work. You can do that by specifying Export-M365DSCConfiguration -Components @("Component1", "Component2",...)....

@FabienTschanz
Copy link
Collaborator

Closing for now. If you require further assistance, feel free to reopen it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants