Skip to content

Unable to import module, "RootModule" is not an approved member of manifest #7

@alexsmid

Description

@alexsmid

Expected Behavior

"Import-module StoragePre2k12" should import the module

Current Behavior

"Import-module StoragePre2k12" gives the following error:

Import-Module : The 'C:\windows\system32\WindowsPowerShell\v1.0\Modules\storagepre2k12\storagepre2k12.psd1' module cann
ot be imported because its manifest contains one or more members that are not valid. The valid manifest members are ('M
oduleToProcess', 'NestedModules', 'GUID', 'Author', 'CompanyName', 'Copyright', 'ModuleVersion', 'Description', 'PowerS
hellVersion', 'PowerShellHostName', 'PowerShellHostVersion', 'CLRVersion', 'DotNetFrameworkVersion', 'ProcessorArchitec
ture', 'RequiredModules', 'TypesToProcess', 'FormatsToProcess', 'ScriptsToProcess', 'PrivateData', 'RequiredAssemblies'
, 'ModuleList', 'FileList', 'FunctionsToExport', 'VariablesToExport', 'AliasesToExport', 'CmdletsToExport'). Remove the
 members that are not valid ('RootModule'), then try to import the module again.
At line:1 char:14
+ import-module <<<<  storagepre2k12
    + CategoryInfo          : InvalidData: (C:\windows\syst...agepre2k12.psd1:String) [Import-Module], InvalidOperatio
   nException
    + FullyQualifiedErrorId : Modules_InvalidManifestMember,Microsoft.PowerShell.Commands.ImportModuleCommand

Possible Solution

Replace "RootModule" with "ModuleToProcess" in the module manifest

Steps to Reproduce

On PS 2.0:
Import-Module StoragePre2k12

Context

I am using this to resize disk on a Windows Server 2008 R2 system
Your Environment

$psversiontable

Name                           Value
----                           -----
CLRVersion                     2.0.50727.8800
BuildVersion                   6.1.7601.17514
PSVersion                      2.0
WSManStackVersion              2.0
PSCompatibleVersions           {1.0, 2.0}
SerializationVersion           1.1.0.1
PSRemotingProtocolVersion      2.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions