Comments (6)
@solaireofastora20 in the sccm section, use the FQDN for SqlServerName.
from automatedlab.
Will try to get to it next week
from automatedlab.
Seeing the same thing:
Failed to add Windows Defender exclusions (Cannot validate argument on parameter 'ExclusionPath'. The argument is null or empty. Provide an a
rgument that is not null or empty, and then try the command again.)
Cannot validate argument on parameter 'ExclusionPath'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again.
At C:\Program Files\WindowsPowerShell\Modules\AutomatedLabWorker\5.49.0\AutomatedLabWorker.psm1:5134 char:32
+ $result.AddRange(@(Invoke-Command @parameters))
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Add-MpPreference], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Add-MpPreference
from automatedlab.
Running into the same issues as well - was wondering if anyone had a fix for this yet
from automatedlab.
@solaireofastora20 in the sccm section, use the FQDN for SqlServerName.
I tried changing the SqlServerName to the FQDN and while it does work (after the initial PowerShell code changes I mentioned in my initial issue submission), it seems to not take on the SiteCode parameter and defaults back to AL1. It also spammed a lot of errors when (I think it was checking the debug file) after the installation was done.
I then decided to take another approach and changed the code to be below as it seemed more accurate to the documentation:
$labName = "ADLab"
$labSources = "C:\AutomatedLabs\LabSources"
$labPath = Join-Path -Path "C:\AutomatedLabs" -ChildPath $labName
if (-not (Test-Path $labPath)) { New-Item $labPath -ItemType Directory | Out-Null }
New-LabDefinition -Name $labName -DefaultVirtualizationEngine HyperV -VmPath $labPath
Add-LabVirtualNetworkDefinition -Name $labName -AddressSpace 10.0.0.0/24
Add-LabIsoImageDefinition -Name Server2019 -Path "C:\AutomatedLabs\LabSources\ISOs\17763.3650.221105-1748.rs5_release_svc_refresh_SERVER_EVAL_x64FRE_en-us.iso"
Add-LabIsoImageDefinition -Name SQLServer2022 -Path "C:\AutomatedLabs\LabSources\ISOs\SQLServer2022-x64-ENU.iso"
Add-LabIsoImageDefinition -Name Windows10 -Path "C:\AutomatedLabs\LabSources\ISOs\WindowsUS.iso"
$PSDefaultParameterValues = @{
'Add-LabMachineDefinition:DomainName' = 'contoso.com'
'Add-LabMachineDefinition:Memory' = 3221225472
}
$installCredential = New-Object PSCredential('Administrator',('SomePassword1234!*'|ConvertTo-SecureString -AsPlainText -Force))
Add-LabDomainDefinition -Name contoso.com -AdminUser "Administrator" -AdminPassword "SomePassword1234!*"
Add-LabMachineDefinition -Name DC01 -Roles RootDC -InstallationUserCredential $installCredential -IpAddress 10.0.0.2 -DnsServer1 10.0.0.2 -IsDomainJoined -Network $labName -OperatingSystem "Windows Server 2019 Datacenter Evaluation (Desktop Experience)"
$sqlRole = Get-LabMachineRoleDefinition -Role SQLServer2022 -Properties @{ Collation = 'SQL_Latin1_General_CP1_CI_AS'}
Add-LabMachineDefinition -Name SQL01 -Roles $sqlRole -IsDomainJoined -IpAddress 10.0.0.3 -Network $labName -InstallationUserCredential $installCredential -OperatingSystem "Windows Server 2019 Datacenter Evaluation (Desktop Experience)"
Add-LabMachineDefinition -Name WS01 -DomainName contoso.com -IsDomainJoined -IpAddress 10.0.0.5 -Network $labName -InstallationUserCredential $installCredential -OperatingSystem "Windows 10 Pro"
Add-LabMachineDefinition -Name WS02 -DomainName contoso.com -IsDomainJoined -IpAddress 10.0.0.6 -Network $labName -InstallationUserCredential $installCredential -OperatingSystem "Windows 10 Pro"
$sccmRole = Get-LabMachineRoleDefinition -Role ConfigurationManager -Properties @{
Roles='Management Point,Distribution Point'
SiteName='ContosoCM'
SiteCode='CCM'
SqlServerName='SQL01.contoso.com'
DatabaseName='CCMDB'
}
Add-LabMachineDefinition -Name SCCM01 -DomainName contoso.com -IsDomainJoined -Roles $sccmRole -IpAddress 10.0.0.4 -Network $labName -InstallationUserCredential $installCredential -OperatingSystem "Windows Server 2019 Datacenter Evaluation (Desktop Experience)"
Install-Lab -Verbose
Show-LabDeploymentSummary -Detailed
This then resulted in the same issue I mentioned earlier in this message where the SiteCode and SiteName doesn't seem to change (and I'm assuming the SQL DB etc doesn't change either).
As a result of this AL can't seem to validate the install and I get the following message at the end:
13:52:37|02:27:30|00:00:01.011| - Failed to validate install, could not find site code 'CCM' in SMS_Site class (The WS-Management service cannot process the request. The CIM namespace root/sms/site_ccm is invalid. )
Just to clarify, the initial fix (for the others that are asking):
In your AutomatedLabCore.psm1 (likely installed at C:\Program Files\WindowsPowerShell\Modules\AutomatedLabCore\5.49.0 if you used the MSI), at line 1375 it reads:
$result = Invoke-LabCommand -ComputerName $CMServer -ActivityName "Adding Windows Defender exclusions" -Variable (Get-Variable "AVExcludedPaths", "AVExcludedProcesses") -ScriptBlock {
Add-MpPreference -ExclusionPath $configurationManagerAVExcludedPaths -ExclusionProcess $configurationManagerAVExcludedProcesses -ErrorAction "Stop"
Set-MpPreference -RealTimeScanDirection "Incoming" -ErrorAction "Stop"
} -ErrorAction Stop
If you change that to the following, it should work (although you'll run into the same sitecode etc not changing I just mentioned):
$result = Invoke-LabCommand -ComputerName $CMServer -ActivityName "Adding Windows Defender exclusions" -Variable (Get-Variable "configurationManagerAVExcludedPaths", "configurationManagerAVExcludedProcesses") -ScriptBlock { Add-MpPreference -ExclusionPath $configurationManagerAVExcludedPaths -ExclusionProcess $configurationManagerAVExcludedProcesses -ErrorAction "Stop" Set-MpPreference -RealTimeScanDirection "Incoming" -ErrorAction "Stop" } -ErrorAction Stop
from automatedlab.
Hi!
I tried to reproduce the errors mentioned by @solaireofastora20
My environment is:
C:\WINDOWS\system32> $PSVersionTable
Name Value
---- -----
PSVersion 5.1.22621.2506
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.22621.2506
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
C:\WINDOWS\system32> Get-Module | where {$_.Name -like "*Automated*"} | Select Name,Version
Name Version
---- -------
AutomatedLab 5.50.0
AutomatedLab.Common 2.3.17
AutomatedLab.Recipe 5.50.0
AutomatedLab.Ships 5.50.0
AutomatedLabCore 5.50.0
AutomatedLabDefinition 5.50.0
AutomatedLabNotifications 5.50.0
AutomatedLabTest 5.50.0
AutomatedLabUnattended 5.50.0
AutomatedLabWorker 5.50.0
To deploy SCCM lab I use pre-defined script from default LabSources folder:
"C:\LabSources\SampleScripts\Scenarios\CM-2203.ps1"
Accordingly edited to install Configuration Manager:
$cmRole = Get-LabMachineRoleDefinition -Role ConfigurationManager -Properties @{
Version = '2203';
Roles = 'Management Point,Distribution Point';
SiteName = 'ConSite';
SiteCode = 'CCM';
SqlServerName = 'CMDB01.contoso.com';
DatabaseName = 'CCM_DB'
}
When I call the script after a while I receive such error:
13:39:13|00:48:31|00:00:00.000| Adding Windows Defender exclusions
Get-Variable : Cannot find a variable with the name 'AVExcludedPaths'.
At C:\Program Files\WindowsPowerShell\Modules\AutomatedLabCore\5.50.0\AutomatedLabCore.psm1:1375 char:123
+ ... -Variable (Get-Variable "AVExcludedPaths", "AVExcludedProcesses") -S ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (AVExcludedPaths:String) [Get-Variable], ItemNotFoundException
+ FullyQualifiedErrorId : VariableNotFound,Microsoft.PowerShell.Commands.GetVariableCommand
Get-Variable : Cannot find a variable with the name 'AVExcludedProcesses'.
At C:\Program Files\WindowsPowerShell\Modules\AutomatedLabCore\5.50.0\AutomatedLabCore.psm1:1375 char:123
+ ... -Variable (Get-Variable "AVExcludedPaths", "AVExcludedProcesses") -S ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (AVExcludedProcesses:String) [Get-Variable], ItemNotFoundException
+ FullyQualifiedErrorId : VariableNotFound,Microsoft.PowerShell.Commands.GetVariableCommand
13:39:14|00:48:31|00:00:00.000| - Executing lab command activity: 'Adding Windows Defender exclusions' on machines 'CMCM01'
13:39:14|00:48:31|00:00:00.015| - Waiting for completion
13:39:15|00:48:33|00:00:01.670| - Failed to add Windows Defender exclusions (Cannot validate argument on parameter 'ExclusionPath'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again.)
Cannot validate argument on parameter 'ExclusionPath'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again.
At C:\Program Files\WindowsPowerShell\Modules\AutomatedLabWorker\5.50.0\AutomatedLabWorker.psm1:5185 char:32
+ $result.AddRange(@(Invoke-Command @parameters))
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Add-MpPreference], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Add-MpPreference
As OP mentioned, solution to that is line 1375 modification of C:\Program Files\WindowsPowerShell\Modules\AutomatedLabCore\5.50.0\AutomatedLabCore.psm1
from:
$result = Invoke-LabCommand -ComputerName $CMServer -ActivityName "Adding Windows Defender exclusions" -Variable (Get-Variable "AVExcludedPaths", "AVExcludedProcesses") -ScriptBlock {
to:
$result = Invoke-LabCommand -ComputerName $CMServer -ActivityName "Adding Windows Defender exclusions" -Variable (Get-Variable "configurationManagerAVExcludedPaths", "configurationManagerAVExcludedProcesses") -ScriptBlock {
Remember to re-load module for next run:
Import-Module -Name AutomatedLabCore -Force
Proceeding to next sub-issue reported by OP.
I also confirm this symptom. Process hangs on 'Validating install' step:
15:01:02|01:18:18|00:00:00.000| Validating install
15:01:03|01:18:18|00:00:00.659| - Failed to validate install, could not find site code 'CCM' in SMS_Site class (The WS-Management service cannot process the request. The CIM namespace root/sms/site_ccm is invalid. )
cmdlet Write-PSFMessage at command pipeline position 2
Supply values for the following parameters:
Message:
Installation of SCCM is performed using CM unattended file
Such file is created on a fly using arguments provided in a deployment script (if provided, otherwise default values are used). It is saved into "C:\LabSources\SoftwarePackages\ConfigurationFile-CM-CMCM01.ini"
If you happen to open such a file, you will notice that the values for SiteCode
and SiteName
are not being passed correctly, and although you have adjusted it, the default values are there:
[SQLConfigOptions]
SQLServerName = CMDB01.contoso.com
DatabaseName = CCM_DB
[CloudConnectorOptions]
CloudConnector = 1
UseProxy = 0
CloudConnectorServer = CMCM01.contoso.com
[Identification]
Action = InstallPrimarySite
[SystemCenterOptions]
[HierarchyExpansionOption]
[Options]
JoinCEIP = 0
SiteCode = AL1
SMSInstallDir = C:\Program Files\Microsoft Configuration Manager
PrerequisiteComp = 1
ClientsUsePKICertificate = 0
ManagementPointProtocol = HTTP
DistributionPointProtocol = HTTP
SDKServer = CMCM01.contoso.com
AdminConsole = 1
DistributionPointInstallIIS = 1
ManagementPoint = CMCM01.contoso.com
RoleCommunicationProtocol = HTTPorHTTPS
ProductID = EVAL
DistributionPoint = CMCM01.contoso.com
PrerequisitePath = C:\Install\CM-Prereqs
SiteName = AutomatedLab-01
To fix this go to C:\Program Files\WindowsPowerShell\Modules\AutomatedLabCore\5.50.0\AutomatedLabCore.psm1
and after line 1276 add two new entries:
$CMSetupConfig['[Options]'].SiteCode = $CMSiteCode
$CMSetupConfig['[Options]'].SiteName = $CMSiteName
I have tested few mixed scenarios with succesful results.
Side proposal. I would move CM DB name declaration from Install-CMSite function (line 1236) to $configurationManagerContent table (line 27691) to preserve consistency of a code. Or maybe there is a reason for such way?
@bpersino mentions about providing FQDN of SQL Server. The reason for that is to meet CM setup requirements. If you provide just a name of SQL Server, CM setup will return:
WARNING: 'CMDB01' is not a valid FQDN because the format is invalid. $$<Configuration Manager Setup><02-05-2024 23:57:01.562-60><thread=6324 (0x18B4)>
~Invalid fully qualified domain name. $$<Configuration Manager Setup><02-05-2024 23:57:01.562-60><thread=6324 (0x18B4)>
In order to prevent such an occurrence, it would be good to introduce a verification mechanism. Testing whether the custom argument given to the script is FQDN. We could use parameter attribute ValidatePattern.
[Parameter(Mandatory)]
[ValidatePattern("^(([a-z0-9][a-z0-9\-]*[a-z0-9])|[a-z0-9]+\.)*([a-z]+|xn\-\-[a-z0-9]+)\.?$")]
[string]$SqlServerName,
Output of such:
01:42:40|00:33:24|00:00:00.000| Deploying System Center Configuration Manager
01:42:50|00:33:34|00:00:09.957| - ...........
01:44:57|00:35:41|00:02:16.782| - Installing Prerequisites on 1 machines
01:46:05|00:36:49|00:03:24.765| - ........
01:47:39|00:38:23|00:04:59.049| - ......
01:48:49|00:39:33|00:00:00.000| - Installing software package 'C:\LabSources\SoftwarePackages\sqlncli.msi' on machines 'CMCM01'
01:48:49|00:39:33|00:00:00.141| - Copying files and initiating setup on 'CMCM01' and waiting for completion..
01:48:56|00:39:40|00:00:06.928| - Installation done
01:54:37|00:45:21|00:00:00.000| - Executing lab command activity: 'Add computer account as local admin (why...)' on machines 'CMDB01'
01:54:37|00:45:21|00:00:00.013| - Waiting for completion
01:54:47|00:45:31|00:00:10.493| - Activity done
Install-CMSite : Cannot validate argument on parameter 'SqlServerName'. The argument "CMDB01" does not match the "^(([a-z0-9][a-z0-9\-]*[a-z0-9])|[a-z0-9]+\.)*([a-z]+|xn\-\-[a-z0-9]+)\.?$" pattern. Supply an argument that matches "^(([a
-z0-9][a-z0-9\-]*[a-z0-9])|[a-z0-9]+\.)*([a-z]+|xn\-\-[a-z0-9]+)\.?$" and try the command again.
At C:\Program Files\WindowsPowerShell\Modules\AutomatedLabCore\5.50.0\AutomatedLabCore.psm1:10745 char:24
+ Install-CMSite @siteParameter
+ ~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Install-CMSite], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Install-CMSite
from automatedlab.
Related Issues (20)
- [Bug]: WinRM port never opens
- Is there a way to install sysmon with options? HOT 2
- [New Feature]: Map Host Folders to VM HOT 2
- [Bug]: Timeout when 'Starting remaining machines' HOT 5
- [Bug]: Hyper-V VM created with -VmGeneration 1 fails to boot HOT 8
- [Bug]: Hyper-V VM having network adapter created with -UseDhcp gets static IP assigned HOT 4
- [New Feature]: Do not delete Virtual Switch during Remove-Lab HOT 1
- Get-Lab command only reports one response HOT 6
- [New Feature]: Support for Oracle Linux HOT 3
- [Bug]: CM-2103.ps1 not working, loose "lab context" in Customroles script, (Get-LabVM return NULL)
- [New Feature]: HOT 1
- [Bug]: Download of SysInternals suite sometimes fails HOT 1
- Documentation: List not formatted in markdown HOT 1
- [Bug]: Virtual network could not be created automatically HOT 1
- [Bug]: Custom role not installed, lab sources file share not accessible HOT 4
- [Bug]: Timeout Error Waiting for Active Directory to Start on Domain Controller HOT 1
- [Bug]: Secondary DC installation is not reentrant HOT 3
- [New Feature]: System Drive Cleanup HOT 2
- [Bug]: VMConnect config file creation fails under SYSTEM HOT 1
- [Bug]: Cannot validate argument on parameter 'ParentPath' HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from automatedlab.