Details of the scenario you tried and the problem that is occurring
Installing the nupkg file from a local repository stores the module in "$env:ProgramFiles\WindowsPowerShell\Modules\AuditPolicyDsc\1.4.0". The correct directory should be "$env:ProgramFiles\WindowsPowerShell\Modules\AuditPolicyDsc\1.4.0.0".
The version in "AuditPolicyDsc.psd1" (1.4.0.0) does not match the directory name (1.4.0) and Import-Module fails.
Verbose logs showing the problem
PS C:\Users\Administrator> Import-Module -Name 'AuditPolicyDsc'
Import-Module : The specified module 'AuditPolicyDsc' was not loaded because no valid module file was found in any module directory.
At line:1 char:1
+ Import-Module -Name 'AuditPolicyDsc'
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ResourceUnavailable: (AuditPolicyDsc:String) [Import-Module], FileNotFoundException
+ FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand
PS C:\Users\Administrator> Import-Module -Name "C:\Program Files\WindowsPowerShell\Modules\AuditPolicyDsc\1.4.0\AuditPolicyDsc.psd1"
Import-Module : The ModuleVersion key in module manifest 'C:\Program Files\WindowsPowerShell\Modules\AuditPolicyDsc\1.4.0\AuditPolicyDsc.psd1' specifies module version '1.4.0.0' which does not match
its version folder name at 'C:\Program Files\WindowsPowerShell\Modules\AuditPolicyDsc\1.4.0'. Change the value of the ModuleVersion
key to match the version folder name.
At line:1 char:1
+ Import-Module -Name "C:\Program Files\WindowsPowerShell\Modules\Audit ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (C:\Program File...tPolicyDsc.psd1:String) [Import-Module], InvalidOperationException
+ FullyQualifiedErrorId : Modules_InvalidModuleManifestVersion,Microsoft.PowerShell.Commands.ImportModuleCommand
Suggested solution to the issue
N/A
The DSC configuration that is used to reproduce the issue (as detailed as possible)
Save a copy of 'AuditPolicyDsc.1.4.0.nupkg' to 'C:\Setup\LocalPSRepo'
Setup a local repository and install the module
$LocalPSRepo = @{
Name = 'LocalPSRepo'
SourceLocation = 'C:\Setup\LocalPSRepo'
ScriptSourceLocation = 'C:\Setup\LocalPSRepo'
InstallationPolicy = 'Trusted'
}
Register-PSRepository @LocalPSRepo
Install-Module -Name 'AuditPolicyDsc -Repository 'LocalPSRepo' -Scope AllUsers -Verbose
Observe incorrect directory name in $env:ProgramFiles\WindowsPowerShell\Modules\AuditPolicyDsc\
The operating system the target node is running
OsName : Microsoft Windows Server 2022 Datacenter
OsOperatingSystemSKU : DatacenterServerEdition
OsArchitecture : 64-bit
WindowsVersion : 2009
WindowsBuildLabEx : 20348.1.amd64fre.fe_release.210507-1500
OsLanguage : en-US
OsMuiLanguages : {en-US}
Version and build of PowerShell the target node is running
PSVersion 5.1.20348.2227
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.20348.2227
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
Version of the DSC module that was used ('dev' if using current dev branch)
1.4.0.0
Details of the scenario you tried and the problem that is occurring
Installing the nupkg file from a local repository stores the module in "$env:ProgramFiles\WindowsPowerShell\Modules\AuditPolicyDsc\1.4.0". The correct directory should be "$env:ProgramFiles\WindowsPowerShell\Modules\AuditPolicyDsc\1.4.0.0".
The version in "AuditPolicyDsc.psd1" (1.4.0.0) does not match the directory name (1.4.0) and Import-Module fails.
Verbose logs showing the problem
Suggested solution to the issue
N/A
The DSC configuration that is used to reproduce the issue (as detailed as possible)
Save a copy of 'AuditPolicyDsc.1.4.0.nupkg' to 'C:\Setup\LocalPSRepo'
Setup a local repository and install the module
Observe incorrect directory name in $env:ProgramFiles\WindowsPowerShell\Modules\AuditPolicyDsc\
The operating system the target node is running
OsName : Microsoft Windows Server 2022 Datacenter
OsOperatingSystemSKU : DatacenterServerEdition
OsArchitecture : 64-bit
WindowsVersion : 2009
WindowsBuildLabEx : 20348.1.amd64fre.fe_release.210507-1500
OsLanguage : en-US
OsMuiLanguages : {en-US}
Version and build of PowerShell the target node is running
PSVersion 5.1.20348.2227
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.20348.2227
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
Version of the DSC module that was used ('dev' if using current dev branch)
1.4.0.0