Hi,
I am trying to configure app pools with a specific AD user account. It’s for an on-prem Windows Server 2019 standard. The error I get is
PowerShell DSC resource DSC_WebAppPool failed to execute Set-TargetResource functionality with error message: AppCmd.exe has exited with error code "13".
when I run the command:
Start-DscConfiguration -Path .\MultipleAppPools\ -ComputerName server1 -Wait -Verbose -Force
The script I’m using to generate the MOF file is:
Configuration MultipleAppPools
{
param
(
[parameter(Mandatory)]
[pscustomobject[]]
$AppPools
)
Import-DscResource -ModuleName WebAdministrationDsc
Node server1
{
foreach ($AppPool in $AppPools) {
WebAppPool $AppPool.Service {
Name = $AppPool.Service
Ensure = "Present"
State = "Started"
autoStart = $true
idleTimeout = $AppPool.Timeout
restartPrivateMemoryLimit = $AppPool.Memory
logEventOnRecycle = "Time,Memory,PrivateMemory"
identityType = "SpecificUser"
Credential = $credential
} #WebAppPool
}#foreach
}#node
} #Configuration MultipleAppPools
$configData = @{
AllNodes = @(
@{
NodeName = '*'
PSDscAllowDomainUser = $true
PSDscAllowPlainTextPassword = $true
}
);
NonNodeData = ''
} #configdata
# Read the contents of the JSON file
$json = Get-Content -Path "settings.json" -Raw
# Convert the JSON data to a custom object
$appPools = ConvertFrom-Json -InputObject $json
# Get credentials
$credential = (Import-CliXml -Path 'C:\temp\cred.xml')
# Pass the custom object to the MultipleAppPools cmdlet
MultipleAppPools -AppPools $appPools -ConfigurationData $configData -OutputPath:"./MultipleAppPools"
It looks like it is generating the mof file correctly. I know that it’s not the best idea to include credentials in the mof, but after applying config I intend to delete it. I can see the password is correct in the mof file. Any help would be appreciated regarding this error.
I have noticed that in the advanced settings of the app pool I can see ‘SpecificUser’ in the Process model → Identity. I was expecting that field to have the actual username, I have configured other app pools manually with a custom user and they have the actuall username in that field, so I’m not sure if the config script is correct.