-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to use module from within a script #109
Comments
Can you add I'm curious to see if the module is being seen. You may want to run |
@CalebAlbers Thanks for the reply :). I ran $env:PSModulePath, and it came back with C:\Program Files\WindowsPowerShell\Modules as one of the directories in the path, and that directory does contain the files for the ITGlueAPI powershell module. As for the other test commands, I cannot get them to work in the script, but they work fine on my workstation. I ran the following commands on my workstation:
The result is I have text files on my C: drive with the command output with info for the ITGlueAPI module visible. I pasted these exact same commands into the script, and the files that I get are completely blank. Am I doing something wrong, or is this also part of the problem? |
Did you run |
Yes, I can confirm the module appears when I run Get-Module on the server that the script is running on. I can import the module and use the commands with no issues outside of the script, but the script itself cannot use any of the module commands at all after I import the module. |
@CalebAlbers @ecspresso Have there been any updates to this issue? Thanks so much :) |
I know this is two years old at this point, but I wonder if #131 fixes this - shipping imminently in |
Steps to reproduce
Create blank powershell script
Call "Import-Module ITGlueAPI" in script
Call "Add-ITGlueApiKey" in script
Expected behavior
Run the command Add-ITGlueAPIKey
Actual behavior
Returns the error: "The term 'Add-ITGlueAPIKey' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again."
The script is being run by a windows service, and for whatever reason it cannot "see" those commands and I don't know why
Screenshots
N/A
Environment
Please share additional details about your environment. Version information for:
Environment command output:
OsName : Microsoft Windows Server 2012 R2 Standard
OsOperatingSystemSKU : StandardServerEdition
OsArchitecture : 64-bit
WindowsBuildLabEx : 9600.19812.amd64fre.winblue_ltsb_escrow.200814-1823
OsLanguage : en-US
OsMuiLanguages : {en-US}
The text was updated successfully, but these errors were encountered: