Module: Commands are not exported with Version 3.8.0
See original GitHub issueDetails of the scenario you tried and the problem that is occurring
I am having the issue that for me no cmdlet/function is actually exported from the module:
Verbose logs showing the problem
The Import is happening but the Export is missing:
PS C:\Users\A60015022.SSZADMBIT> Import-Module SharePointDSC -Verbose
VERBOSE: Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\SharePointDSC\SharePointDSC.psd1'.
VERBOSE: Loading module from path 'C:\Program
Files\WindowsPowerShell\Modules\SharePointDSC\Modules\SharePointDsc.Util\SharePointDsc.Util.psm1'.
VERBOSE: Importing function 'Add-SPDscUserToLocalAdmin'.
VERBOSE: Importing function 'Clear-SPDscKerberosToken'.
VERBOSE: Importing function 'Convert-SPDscADGroupIDToName'.
VERBOSE: Importing function 'Convert-SPDscADGroupNameToID'.
VERBOSE: Importing function 'Convert-SPDscArrayToString'.
VERBOSE: Importing function 'Convert-SPDscCIMInstanceToString'.
VERBOSE: Importing function 'Convert-SPDscHashtableToString'.
VERBOSE: Importing function 'ConvertTo-ReverseString'.
VERBOSE: Importing function 'ConvertTo-TwoDigitFlipString'.
VERBOSE: Importing function 'Format-OfficePatchGUID'.
VERBOSE: Importing function 'Get-SPDscAssemblyVersion'.
VERBOSE: Importing function 'Get-SPDscBuildVersion'.
VERBOSE: Importing function 'Get-SPDscContentService'.
VERBOSE: Importing function 'Get-SPDscFarmAccount'.
VERBOSE: Importing function 'Get-SPDscFarmAccountName'.
VERBOSE: Importing function 'Get-SPDscFarmProductsInfo'.
VERBOSE: Importing function 'Get-SPDscFarmVersionInfo'.
VERBOSE: Importing function 'Get-SPDscInstalledProductVersion'.
VERBOSE: Importing function 'Get-SPDscOSVersion'.
VERBOSE: Importing function 'Get-SPDscRegistryKey'.
VERBOSE: Importing function 'Get-SPDscRegProductsInfo'.
VERBOSE: Importing function 'Get-SPDscServerPatchStatus'.
VERBOSE: Importing function 'Get-SPDscServiceContext'.
VERBOSE: Importing function 'Get-SPDscUserProfileSubTypeManager'.
VERBOSE: Importing function 'Invoke-SPDscCommand'.
VERBOSE: Importing function 'Remove-SPDscGenericObject'.
VERBOSE: Importing function 'Remove-SPDscUserToLocalAdmin'.
VERBOSE: Importing function 'Remove-SPDscZoneMap'.
VERBOSE: Importing function 'Rename-SPDscParamValue'.
VERBOSE: Importing function 'Resolve-SPDscSecurityIdentifier'.
VERBOSE: Importing function 'Set-SPDscObjectPropertyIfValuePresent'.
VERBOSE: Importing function 'Set-SPDscZoneMap'.
VERBOSE: Importing function 'Test-SPDscIsADUser'.
VERBOSE: Importing function 'Test-SPDscObjectHasProperty'.
VERBOSE: Importing function 'Test-SPDscParameterState'.
VERBOSE: Importing function 'Test-SPDscRunAsCredential'.
VERBOSE: Importing function 'Test-SPDscRunningAsFarmAccount'.
VERBOSE: Importing function 'Test-SPDscUserIsLocalAdmin'.
Suggested solution to the issue
It seems, in the module manifest (.psd1), all the commands are listed under “CmdletsToExport”. This seems to be wrong though, as these are not Cmdlets, but Functions. When adding the same commands to “FunctionsToExport”, all the commands are exported correctly.
SharePointDsc.psd1 part, before (does not work for me):
# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess
NestedModules = @("Modules\SharePointDsc.Util\SharePointDsc.Util.psm1"
)
# Functions to export from this module
FunctionsToExport = @()
# Cmdlets to export from this module
CmdletsToExport = @("Invoke-SPDscCommand",
"Get-SPDscInstalledProductVersion",
"Get-SPDscContentService",
"Rename-SPDscParamValue",
"Add-SPDscUserToLocalAdmin",
"Remove-SPDscUserToLocalAdmin",
"Test-SPDscObjectHasProperty",
"Test-SPDscRunAsCredential",
"Test-SPDscUserIsLocalAdmin",
"Test-SPDscParameterState",
"Test-SPDscIsADUser",
"Test-SPDscRunningAsFarmAccount",
"Set-SPDscObjectPropertyIfValuePresent",
"Get-SPDscUserProfileSubTypeManager",
"Get-SPDscOSVersion",
"Get-SPDscRegistryKey",
"Resolve-SPDscSecurityIdentifier",
"Get-SPDscFarmProductsInfo",
"Get-SPDscFarmVersionInfo",
"Convert-SPDscADGroupIDToName",
"Convert-SPDscADGroupNameToID")
# Variables to export from this module
VariablesToExport = @()
Verbose Output without the Workaround:
PS C:\Users\A60015022.SSZADMBIT> Import-Module SharePointDSC -Verbose
VERBOSE: Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\SharePointDSC\SharePointDSC.psd1'.
VERBOSE: Loading module from path 'C:\Program
Files\WindowsPowerShell\Modules\SharePointDSC\Modules\SharePointDsc.Util\SharePointDsc.Util.psm1'.
VERBOSE: Importing function 'Add-SPDscUserToLocalAdmin'.
VERBOSE: Importing function 'Clear-SPDscKerberosToken'.
VERBOSE: Importing function 'Convert-SPDscADGroupIDToName'.
VERBOSE: Importing function 'Convert-SPDscADGroupNameToID'.
VERBOSE: Importing function 'Convert-SPDscArrayToString'.
VERBOSE: Importing function 'Convert-SPDscCIMInstanceToString'.
VERBOSE: Importing function 'Convert-SPDscHashtableToString'.
VERBOSE: Importing function 'ConvertTo-ReverseString'.
VERBOSE: Importing function 'ConvertTo-TwoDigitFlipString'.
VERBOSE: Importing function 'Format-OfficePatchGUID'.
VERBOSE: Importing function 'Get-SPDscAssemblyVersion'.
VERBOSE: Importing function 'Get-SPDscBuildVersion'.
VERBOSE: Importing function 'Get-SPDscContentService'.
VERBOSE: Importing function 'Get-SPDscFarmAccount'.
VERBOSE: Importing function 'Get-SPDscFarmAccountName'.
VERBOSE: Importing function 'Get-SPDscFarmProductsInfo'.
VERBOSE: Importing function 'Get-SPDscFarmVersionInfo'.
VERBOSE: Importing function 'Get-SPDscInstalledProductVersion'.
VERBOSE: Importing function 'Get-SPDscOSVersion'.
VERBOSE: Importing function 'Get-SPDscRegistryKey'.
VERBOSE: Importing function 'Get-SPDscRegProductsInfo'.
VERBOSE: Importing function 'Get-SPDscServerPatchStatus'.
VERBOSE: Importing function 'Get-SPDscServiceContext'.
VERBOSE: Importing function 'Get-SPDscUserProfileSubTypeManager'.
VERBOSE: Importing function 'Invoke-SPDscCommand'.
VERBOSE: Importing function 'Remove-SPDscGenericObject'.
VERBOSE: Importing function 'Remove-SPDscUserToLocalAdmin'.
VERBOSE: Importing function 'Remove-SPDscZoneMap'.
VERBOSE: Importing function 'Rename-SPDscParamValue'.
VERBOSE: Importing function 'Resolve-SPDscSecurityIdentifier'.
VERBOSE: Importing function 'Set-SPDscObjectPropertyIfValuePresent'.
VERBOSE: Importing function 'Set-SPDscZoneMap'.
VERBOSE: Importing function 'Test-SPDscIsADUser'.
VERBOSE: Importing function 'Test-SPDscObjectHasProperty'.
VERBOSE: Importing function 'Test-SPDscParameterState'.
VERBOSE: Importing function 'Test-SPDscRunAsCredential'.
VERBOSE: Importing function 'Test-SPDscRunningAsFarmAccount'.
VERBOSE: Importing function 'Test-SPDscUserIsLocalAdmin'.
SharePointDsc.psd1 part, after (works for me):
# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess
NestedModules = @("Modules\SharePointDsc.Util\SharePointDsc.Util.psm1"
)
# Functions to export from this module
FunctionsToExport = @("Invoke-SPDscCommand",
"Get-SPDscInstalledProductVersion",
"Get-SPDscContentService",
"Rename-SPDscParamValue",
"Add-SPDscUserToLocalAdmin",
"Remove-SPDscUserToLocalAdmin",
"Test-SPDscObjectHasProperty",
"Test-SPDscRunAsCredential",
"Test-SPDscUserIsLocalAdmin",
"Test-SPDscParameterState",
"Test-SPDscIsADUser",
"Test-SPDscRunningAsFarmAccount",
"Set-SPDscObjectPropertyIfValuePresent",
"Get-SPDscUserProfileSubTypeManager",
"Get-SPDscOSVersion",
"Get-SPDscRegistryKey",
"Resolve-SPDscSecurityIdentifier",
"Get-SPDscFarmProductsInfo",
"Get-SPDscFarmVersionInfo",
"Convert-SPDscADGroupIDToName",
"Convert-SPDscADGroupNameToID")
# Cmdlets to export from this module
CmdletsToExport = @()
Verbose Output with Workaround:
PS C:\Users\A60015022.SSZADMBIT> Import-Module SharePointDSC -Verbose
VERBOSE: Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\SharePointDSC\SharePointDSC.psd1'.
VERBOSE: Loading module from path 'C:\Program
Files\WindowsPowerShell\Modules\SharePointDSC\Modules\SharePointDsc.Util\SharePointDsc.Util.psm1'.
VERBOSE: Importing function 'Add-SPDscUserToLocalAdmin'.
VERBOSE: Importing function 'Clear-SPDscKerberosToken'.
VERBOSE: Importing function 'Convert-SPDscADGroupIDToName'.
VERBOSE: Importing function 'Convert-SPDscADGroupNameToID'.
VERBOSE: Importing function 'Convert-SPDscArrayToString'.
VERBOSE: Importing function 'Convert-SPDscCIMInstanceToString'.
VERBOSE: Importing function 'Convert-SPDscHashtableToString'.
VERBOSE: Importing function 'ConvertTo-ReverseString'.
VERBOSE: Importing function 'ConvertTo-TwoDigitFlipString'.
VERBOSE: Importing function 'Format-OfficePatchGUID'.
VERBOSE: Importing function 'Get-SPDscAssemblyVersion'.
VERBOSE: Importing function 'Get-SPDscBuildVersion'.
VERBOSE: Importing function 'Get-SPDscContentService'.
VERBOSE: Importing function 'Get-SPDscFarmAccount'.
VERBOSE: Importing function 'Get-SPDscFarmAccountName'.
VERBOSE: Importing function 'Get-SPDscFarmProductsInfo'.
VERBOSE: Importing function 'Get-SPDscFarmVersionInfo'.
VERBOSE: Importing function 'Get-SPDscInstalledProductVersion'.
VERBOSE: Importing function 'Get-SPDscOSVersion'.
VERBOSE: Importing function 'Get-SPDscRegistryKey'.
VERBOSE: Importing function 'Get-SPDscRegProductsInfo'.
VERBOSE: Importing function 'Get-SPDscServerPatchStatus'.
VERBOSE: Importing function 'Get-SPDscServiceContext'.
VERBOSE: Importing function 'Get-SPDscUserProfileSubTypeManager'.
VERBOSE: Importing function 'Invoke-SPDscCommand'.
VERBOSE: Importing function 'Remove-SPDscGenericObject'.
VERBOSE: Importing function 'Remove-SPDscUserToLocalAdmin'.
VERBOSE: Importing function 'Remove-SPDscZoneMap'.
VERBOSE: Importing function 'Rename-SPDscParamValue'.
VERBOSE: Importing function 'Resolve-SPDscSecurityIdentifier'.
VERBOSE: Importing function 'Set-SPDscObjectPropertyIfValuePresent'.
VERBOSE: Importing function 'Set-SPDscZoneMap'.
VERBOSE: Importing function 'Test-SPDscIsADUser'.
VERBOSE: Importing function 'Test-SPDscObjectHasProperty'.
VERBOSE: Importing function 'Test-SPDscParameterState'.
VERBOSE: Importing function 'Test-SPDscRunAsCredential'.
VERBOSE: Importing function 'Test-SPDscRunningAsFarmAccount'.
VERBOSE: Importing function 'Test-SPDscUserIsLocalAdmin'.
VERBOSE: Exporting function 'Add-SPDscUserToLocalAdmin'.
VERBOSE: Exporting function 'Convert-SPDscADGroupIDToName'.
VERBOSE: Exporting function 'Convert-SPDscADGroupNameToID'.
VERBOSE: Exporting function 'Get-SPDscContentService'.
VERBOSE: Exporting function 'Get-SPDscFarmProductsInfo'.
VERBOSE: Exporting function 'Get-SPDscFarmVersionInfo'.
VERBOSE: Exporting function 'Get-SPDscInstalledProductVersion'.
VERBOSE: Exporting function 'Get-SPDscOSVersion'.
VERBOSE: Exporting function 'Get-SPDscRegistryKey'.
VERBOSE: Exporting function 'Get-SPDscUserProfileSubTypeManager'.
VERBOSE: Exporting function 'Invoke-SPDscCommand'.
VERBOSE: Exporting function 'Remove-SPDscUserToLocalAdmin'.
VERBOSE: Exporting function 'Rename-SPDscParamValue'.
VERBOSE: Exporting function 'Resolve-SPDscSecurityIdentifier'.
VERBOSE: Exporting function 'Set-SPDscObjectPropertyIfValuePresent'.
VERBOSE: Exporting function 'Test-SPDscIsADUser'.
VERBOSE: Exporting function 'Test-SPDscObjectHasProperty'.
VERBOSE: Exporting function 'Test-SPDscParameterState'.
VERBOSE: Exporting function 'Test-SPDscRunAsCredential'.
VERBOSE: Exporting function 'Test-SPDscRunningAsFarmAccount'.
VERBOSE: Exporting function 'Test-SPDscUserIsLocalAdmin'.
VERBOSE: Importing function 'Add-SPDscUserToLocalAdmin'.
VERBOSE: Importing function 'Convert-SPDscADGroupIDToName'.
VERBOSE: Importing function 'Convert-SPDscADGroupNameToID'.
VERBOSE: Importing function 'Get-SPDscContentService'.
VERBOSE: Importing function 'Get-SPDscFarmProductsInfo'.
VERBOSE: Importing function 'Get-SPDscFarmVersionInfo'.
VERBOSE: Importing function 'Get-SPDscInstalledProductVersion'.
VERBOSE: Importing function 'Get-SPDscOSVersion'.
VERBOSE: Importing function 'Get-SPDscRegistryKey'.
VERBOSE: Importing function 'Get-SPDscUserProfileSubTypeManager'.
VERBOSE: Importing function 'Invoke-SPDscCommand'.
VERBOSE: Importing function 'Remove-SPDscUserToLocalAdmin'.
VERBOSE: Importing function 'Rename-SPDscParamValue'.
VERBOSE: Importing function 'Resolve-SPDscSecurityIdentifier'.
VERBOSE: Importing function 'Set-SPDscObjectPropertyIfValuePresent'.
VERBOSE: Importing function 'Test-SPDscIsADUser'.
VERBOSE: Importing function 'Test-SPDscObjectHasProperty'.
VERBOSE: Importing function 'Test-SPDscParameterState'.
VERBOSE: Importing function 'Test-SPDscRunAsCredential'.
VERBOSE: Importing function 'Test-SPDscRunningAsFarmAccount'.
VERBOSE: Importing function 'Test-SPDscUserIsLocalAdmin'.
This seems to be a general issue as I tested it with the newest Module version (3.8.0) on a Server 2012 R2 with WMF 5.1 and on a Server 2016 1607 and experienced the same problems with both servers, and the same workaround made the commands appear when importing the module.
The DSC configuration that is used to reproduce the issue (as detailed as possible)
N/A
The operating system the target node is running
OsName : Microsoft Windows Server 2012 R2 Standard OsOperatingSystemSKU : StandardServerEdition OsArchitecture : 64-bit WindowsBuildLabEx : 9600.19629.amd64fre.winblue_ltsb_escrow.200127-1700 OsLanguage : en-US OsMuiLanguages : {en-US}
Version of SharePoint that is used (e.g. SharePoint 2016)
N/A
Version and build of PowerShell the target node is running
Name Value
---- -----
PSVersion 5.1.14409.1018
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.14409.1018
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
Version of the DSC module that was used
3.8.0
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (6 by maintainers)
@ykuijs @NikCharlebois Sorry I remembered the cmdlet incorrectly, it was “Get-SPDSCInstalledProductVersion” that is used by SharePointDSC.Reverse, not “Invoke-SPDscCommand” 😃![error](https://user-images.githubusercontent.com/12686296/81779617-57d9a080-94f5-11ea-8ac7-c756a0636045.PNG)
Edit: Used Module/Script Versions: ReverseDSC: 2.0.0.2 SharePointDSC.Reverse: 3.7.0.1
Adding @colinhj and @robegoja