Powershell not importing functions from module
up vote
3
down vote
favorite
I'm trying to setup a NuGet Feed here, and that worked ok. I installed a module from my feed via
Install-Module -Name MyCmdlets -Repository $RepoName -Scope CurrentUser -Force
Import-Module -Name MyCmdlets
However when I run Get-Module, I get no functions and it's a manifest?
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Manifest 1.0 MyCmdlets
If I manually go to the installed location and import manually
Import-Module <my-path>1.0MyCmdlets.psm1
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Script 0.0 MyCmdlets {Create-Project, Get-AuditLogs, Get-..
My manifest file does have these lines so I don't understand why Import-Module
isn't working correctly.
FunctionsToExport = '*'
CmdletsToExport = '*'
powershell module cmdlets powershell-module powershellget
add a comment |
up vote
3
down vote
favorite
I'm trying to setup a NuGet Feed here, and that worked ok. I installed a module from my feed via
Install-Module -Name MyCmdlets -Repository $RepoName -Scope CurrentUser -Force
Import-Module -Name MyCmdlets
However when I run Get-Module, I get no functions and it's a manifest?
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Manifest 1.0 MyCmdlets
If I manually go to the installed location and import manually
Import-Module <my-path>1.0MyCmdlets.psm1
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Script 0.0 MyCmdlets {Create-Project, Get-AuditLogs, Get-..
My manifest file does have these lines so I don't understand why Import-Module
isn't working correctly.
FunctionsToExport = '*'
CmdletsToExport = '*'
powershell module cmdlets powershell-module powershellget
add a comment |
up vote
3
down vote
favorite
up vote
3
down vote
favorite
I'm trying to setup a NuGet Feed here, and that worked ok. I installed a module from my feed via
Install-Module -Name MyCmdlets -Repository $RepoName -Scope CurrentUser -Force
Import-Module -Name MyCmdlets
However when I run Get-Module, I get no functions and it's a manifest?
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Manifest 1.0 MyCmdlets
If I manually go to the installed location and import manually
Import-Module <my-path>1.0MyCmdlets.psm1
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Script 0.0 MyCmdlets {Create-Project, Get-AuditLogs, Get-..
My manifest file does have these lines so I don't understand why Import-Module
isn't working correctly.
FunctionsToExport = '*'
CmdletsToExport = '*'
powershell module cmdlets powershell-module powershellget
I'm trying to setup a NuGet Feed here, and that worked ok. I installed a module from my feed via
Install-Module -Name MyCmdlets -Repository $RepoName -Scope CurrentUser -Force
Import-Module -Name MyCmdlets
However when I run Get-Module, I get no functions and it's a manifest?
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Manifest 1.0 MyCmdlets
If I manually go to the installed location and import manually
Import-Module <my-path>1.0MyCmdlets.psm1
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Script 0.0 MyCmdlets {Create-Project, Get-AuditLogs, Get-..
My manifest file does have these lines so I don't understand why Import-Module
isn't working correctly.
FunctionsToExport = '*'
CmdletsToExport = '*'
powershell module cmdlets powershell-module powershellget
powershell module cmdlets powershell-module powershellget
edited Aug 9 '16 at 15:39
DAXaholic
19.6k33749
19.6k33749
asked Aug 9 '16 at 15:30
user1869558
3291314
3291314
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
up vote
4
down vote
accepted
I guess you haven't set the root module in your .psd1 like so
#
# Module manifest for module 'YourModule'
#
@{
# Script module or binary module file associated with this manifest
RootModule = 'YourModule.psm1'
# Version number of this module.
ModuleVersion = '1.0.0'
...
This is necessary so that when you import your manifest module it also loads the script module
Thank you! Can't believe I missed that. I'll need to review the manifest files more in the future.
– user1869558
Aug 9 '16 at 15:45
I knew that because I did the same a couple of weeks ago :D
– DAXaholic
Aug 9 '16 at 15:45
add a comment |
up vote
0
down vote
For anyone coming across this looking for why their module wont import check that RootModule = 'YourModule.psm1' isn't commented out.
By default when creating a new manifest using New-ModuleManifest it throws a hash in front of this line..
ugh I feel so stupid.
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
4
down vote
accepted
I guess you haven't set the root module in your .psd1 like so
#
# Module manifest for module 'YourModule'
#
@{
# Script module or binary module file associated with this manifest
RootModule = 'YourModule.psm1'
# Version number of this module.
ModuleVersion = '1.0.0'
...
This is necessary so that when you import your manifest module it also loads the script module
Thank you! Can't believe I missed that. I'll need to review the manifest files more in the future.
– user1869558
Aug 9 '16 at 15:45
I knew that because I did the same a couple of weeks ago :D
– DAXaholic
Aug 9 '16 at 15:45
add a comment |
up vote
4
down vote
accepted
I guess you haven't set the root module in your .psd1 like so
#
# Module manifest for module 'YourModule'
#
@{
# Script module or binary module file associated with this manifest
RootModule = 'YourModule.psm1'
# Version number of this module.
ModuleVersion = '1.0.0'
...
This is necessary so that when you import your manifest module it also loads the script module
Thank you! Can't believe I missed that. I'll need to review the manifest files more in the future.
– user1869558
Aug 9 '16 at 15:45
I knew that because I did the same a couple of weeks ago :D
– DAXaholic
Aug 9 '16 at 15:45
add a comment |
up vote
4
down vote
accepted
up vote
4
down vote
accepted
I guess you haven't set the root module in your .psd1 like so
#
# Module manifest for module 'YourModule'
#
@{
# Script module or binary module file associated with this manifest
RootModule = 'YourModule.psm1'
# Version number of this module.
ModuleVersion = '1.0.0'
...
This is necessary so that when you import your manifest module it also loads the script module
I guess you haven't set the root module in your .psd1 like so
#
# Module manifest for module 'YourModule'
#
@{
# Script module or binary module file associated with this manifest
RootModule = 'YourModule.psm1'
# Version number of this module.
ModuleVersion = '1.0.0'
...
This is necessary so that when you import your manifest module it also loads the script module
answered Aug 9 '16 at 15:34
DAXaholic
19.6k33749
19.6k33749
Thank you! Can't believe I missed that. I'll need to review the manifest files more in the future.
– user1869558
Aug 9 '16 at 15:45
I knew that because I did the same a couple of weeks ago :D
– DAXaholic
Aug 9 '16 at 15:45
add a comment |
Thank you! Can't believe I missed that. I'll need to review the manifest files more in the future.
– user1869558
Aug 9 '16 at 15:45
I knew that because I did the same a couple of weeks ago :D
– DAXaholic
Aug 9 '16 at 15:45
Thank you! Can't believe I missed that. I'll need to review the manifest files more in the future.
– user1869558
Aug 9 '16 at 15:45
Thank you! Can't believe I missed that. I'll need to review the manifest files more in the future.
– user1869558
Aug 9 '16 at 15:45
I knew that because I did the same a couple of weeks ago :D
– DAXaholic
Aug 9 '16 at 15:45
I knew that because I did the same a couple of weeks ago :D
– DAXaholic
Aug 9 '16 at 15:45
add a comment |
up vote
0
down vote
For anyone coming across this looking for why their module wont import check that RootModule = 'YourModule.psm1' isn't commented out.
By default when creating a new manifest using New-ModuleManifest it throws a hash in front of this line..
ugh I feel so stupid.
add a comment |
up vote
0
down vote
For anyone coming across this looking for why their module wont import check that RootModule = 'YourModule.psm1' isn't commented out.
By default when creating a new manifest using New-ModuleManifest it throws a hash in front of this line..
ugh I feel so stupid.
add a comment |
up vote
0
down vote
up vote
0
down vote
For anyone coming across this looking for why their module wont import check that RootModule = 'YourModule.psm1' isn't commented out.
By default when creating a new manifest using New-ModuleManifest it throws a hash in front of this line..
ugh I feel so stupid.
For anyone coming across this looking for why their module wont import check that RootModule = 'YourModule.psm1' isn't commented out.
By default when creating a new manifest using New-ModuleManifest it throws a hash in front of this line..
ugh I feel so stupid.
answered Nov 9 at 5:18
James Arber
1
1
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f38854869%2fpowershell-not-importing-functions-from-module%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown