Can't load function after import
ward0 opened this issue · comments
Hello,
I have done the following things:
Install-Module -Name 'Carbon' -AllowClobber
PS C:\Windows\system32> Import-module Carbon
PS C:\Windows\system32> Grant-CAPrivilege
Grant-CAPrivilege : The term 'Grant-CAPrivilege' 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.
At line:1 char:1
- Grant-CAPrivilege
-
+ CategoryInfo : ObjectNotFound: (Grant-CAPrivilege:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException
Side question, on a remote computer with no internet access, i don't want to copy the whole Carbon installation, i only need following modules:
Get-CAPrivilege
Grant-CAPrivilege
Can I do a 'minimal' install to get the functions loaded?
Regards,
Ward
The prefix for Carbon commands is C
so the command you should be calling is Get-CPrivilege
, not Get-CAPrivilege
.
You can selectively import functions from modules with the -Function
parameter, e.g. Import-Module -Name 'Carbon' -Function 'Get-CPrivilege', 'Grant-CPrivilege'
. It won't help you in regards to the size of the Carbon module on disk but will limit the functions that are imported into the current PowerShell session.
We are in the process of breaking Carbon up into smaller, more focused modules. Keep an eye on the Carbon.Permissions module which we're currently working on migrating Grant-CPrivilege
and other permissions related functions to. That module will be much lighter weight to deploy and use.