# Get-Module list module manifest .psd1 file

**URL:** <https://forums.powershell.org/t/get-module-list-module-manifest-psd1-file/6061>\
**Category:** PowerShell Help\
**Created:** [March 23, 2016, 9:33pm UTC](https://forums.powershell.org/t/get-module-list-module-manifest-psd1-file/6061 "2016-03-23T21:33:56Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![bojan-zivkovic](https://avatars.discourse-cdn.com/v4/letter/b/7feea3/32.png) [@bojan-zivkovic](https://forums.powershell.org/u/bojan-zivkovic)\
**Post date:** [March 23, 2016, 9:33pm UTC](https://forums.powershell.org/t/get-module-list-module-manifest-psd1-file/6061/1 "2016-03-23T21:33:56Z")

</div>

Hi, having written PowerShell module with bunch of advanced functions next step was to create module manifest.

`$manifestParams = @{
Author = “Bojan Živković”
CompanyName = “My Company”
RootModule = “.\Tools.psm1”
Path = “Tools.psd1”
}`

`
```
              New-ModuleManifest @manifestParams

```
`

I played with FunctionsToExport and loading of .psd1 worked well. However I noticed in Path property of a module there was a path to .psm1 file instead of .psd1 file. For instance path for built-in module Microsoft.PowerShell.Utility points to .psd1 file. This does not affect functionality but still I want to know how to check whether module manifest exists for some module since there is no cmdlet Get-ModuleManifest.

---

<div class="post-metadata">

**Author:** ![stackexchangeuser4](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/stackexchangeuser4/32/306_2.png) [@stackexchangeuser4](https://forums.powershell.org/u/stackexchangeuser4)\
**Post date:** [March 23, 2016, 10:25pm UTC](https://forums.powershell.org/t/get-module-list-module-manifest-psd1-file/6061/2 "2016-03-23T22:25:50Z")

</div>

One way would be to check the Version property, when no PSD1 file is present it defaults to 0.0 while a Module Manifest has a default version of 1.0

Alternatively when there is no manifest the GUID defaults to 00000000-0000-0000-0000-000000000000

Actually the best check might be the RootModule which is blank when there is no manifest but (AFAIK) should always be present in a manifest (EDIT: as Dave pointed out below modules may be listed under NestedModules so you would need to check that too).

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex019/uploads/powershell/original/1X/385e4f9fe133561ad30a814262fe0e0ae6bc3ef0.png) [@system](https://forums.powershell.org/u/system)\
**Post date:** [March 23, 2016, 10:29pm UTC](https://forums.powershell.org/t/get-module-list-module-manifest-psd1-file/6061/3 "2016-03-23T22:29:32Z")

</div>

You can test for a module manifest by looking for (ModuleName).psd1 in the folder that’s found on the ModuleBase property of the object returned by Get-Module:

```
function Test-ModuleHasManifest([string] $ModuleName)
{
    $module = Get-Module $ModuleName -ListAvailable | Select-Object -First 1
    if ($null -eq $module) { return $false }
    
    $manifestPath = Join-Path $module.ModuleBase "$ModuleName.psd1"

    return Test-Path -LiteralPath $manifestPath -Leaf
}
```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex019/uploads/powershell/original/1X/385e4f9fe133561ad30a814262fe0e0ae6bc3ef0.png) [@system](https://forums.powershell.org/u/system)\
**Post date:** [March 23, 2016, 10:30pm UTC](https://forums.powershell.org/t/get-module-list-module-manifest-psd1-file/6061/4 "2016-03-23T22:30:23Z")

</div>

Incidentally, those built-in modules that show up as type “Manifest” have no RootModule. Instead, they load up everything else with NestedModules in the manifest, which slightly changes the output of Get-Module.

---

<div class="post-metadata">

**Author:** ![stackexchangeuser4](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/stackexchangeuser4/32/306_2.png) [@stackexchangeuser4](https://forums.powershell.org/u/stackexchangeuser4)\
**Post date:** [March 23, 2016, 10:33pm UTC](https://forums.powershell.org/t/get-module-list-module-manifest-psd1-file/6061/5 "2016-03-23T22:33:40Z")

</div>

Ah, so if checking for RootModule you would also need to check NestedModules. Still probably the most reliable means without manually checking the file exists.

---

<div class="post-metadata">

**Author:** ![bojan-zivkovic](https://avatars.discourse-cdn.com/v4/letter/b/7feea3/32.png) [@bojan-zivkovic](https://forums.powershell.org/u/bojan-zivkovic)\
**Post date:** [March 24, 2016, 12:55am UTC](https://forums.powershell.org/t/get-module-list-module-manifest-psd1-file/6061/6 "2016-03-24T00:55:25Z")

</div>

Version property of module is 1.0.

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:41pm UTC](https://forums.powershell.org/t/get-module-list-module-manifest-psd1-file/6061/7 "2024-05-16T20:41:44Z")

</div>


