You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Getting the message "The DISM PS module needs to be installed, this can be done through the windows-adk chocolately package" even when the module has been installed - using Chocolatey.
Other info - the suggested version of windows-adk is no longer available on Chocolatey (
- name: Install Windows ADK with DISM for Server 2008 R2chocolatey.chocolatey.win_chocolatey:
name: windows-adkversion: 8.100.26866.0state: presentinstall_args: /features OptionId.DeploymentTools
So deleted the 'version' line and let it install the latest version.
This appears to be the problematic part of the module:
if (Get-Module-Name DISM -ListAvailable) {
Import-Module-Name DISM
}
else {
# Server 2008 R2 doesn't have the DISM module installed on the path, check the Windows ADK path$adk_root= [System.Environment]::ExpandEnvironmentVariables("%PROGRAMFILES(X86)%\Windows Kits\*\Assessment and Deployment Kit\Deployment Tools\amd64\DISM")
if (Test-Path-LiteralPath $adk_root) {
Import-Module-Name (Get-Item-LiteralPath $adk_root).FullName
}
else {
Fail-Json $result"The DISM PS module needs to be installed, this can be done through the windows-adk chocolately package"
}
}`
The path certainly does exist.
EXPECTED RESULTS
Expect to apply hotfix to my Windows Server 2008r2 server.
ACTUAL RESULTS
"The DISM PS module needs to be installed, this can be done through the windows-adk chocolately package"
The text was updated successfully, but these errors were encountered:
I just want to add my own fix for this; I'm not an expert, and i'm sure it's not up to scratch as a proper fix, but it works for me.
if (Get-Module-Name DISM -ListAvailable) {
Import-Module-Name DISM
}
else {
# Correctly resolve the path to the Windows Kits directory, including handling the wildcard for version.$baseAdkPath="${env:ProgramFiles(x86)}\Windows Kits"$adkVersionPaths=Get-ChildItem-Path $baseAdkPath-Directory |Where-Object { $_.Name-match'^\d+' } |Select-Object-ExpandProperty FullName
$moduleImported=$falseforeach ($versionPathin$adkVersionPaths) {
$adkDismPath="$versionPath\Assessment and Deployment Kit\Deployment Tools\amd64\DISM"$dismModulePath=Join-Path-Path $adkDismPath-ChildPath "DISM.psd1"if (Test-Path$dismModulePath) {
Import-Module-Name $dismModulePath-ErrorAction SilentlyContinue
if ($?) {
$moduleImported=$truebreak
}
}
}
if (-not$moduleImported) {
Fail-Json $result"The DISM PS module needs to be installed, this can be done through the windows-adk chocolately package"
}
}
SUMMARY
Getting the message "The DISM PS module needs to be installed, this can be done through the windows-adk chocolately package" even when the module has been installed - using Chocolatey.
ISSUE TYPE
COMPONENT NAME
ANSIBLE VERSION
COLLECTION VERSION
CONFIGURATION
OS / ENVIRONMENT
STEPS TO REPRODUCE
Other info - the suggested version of windows-adk is no longer available on Chocolatey (
So deleted the 'version' line and let it install the latest version.
This appears to be the problematic part of the module:
The path certainly does exist.
EXPECTED RESULTS
Expect to apply hotfix to my Windows Server 2008r2 server.
ACTUAL RESULTS
"The DISM PS module needs to be installed, this can be done through the windows-adk chocolately package"
The text was updated successfully, but these errors were encountered: