question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Module: Commands are not exported with Version 3.8.0

See original GitHub issue

Details 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: SharepointDSC

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:closed
  • Created 4 years ago
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
PowershellNinjacommented, May 13, 2020

@ykuijs @NikCharlebois Sorry I remembered the cmdlet incorrectly, it was “Get-SPDSCInstalledProductVersion” that is used by SharePointDSC.Reverse, not “Invoke-SPDscCommand” 😃 error

Edit: Used Module/Script Versions: ReverseDSC: 2.0.0.2 SharePointDSC.Reverse: 3.7.0.1

0reactions
NikCharleboiscommented, May 13, 2020

Adding @colinhj and @robegoja

Read more comments on GitHub >

github_iconTop Results From Across the Web

python - Unable to import a module that is definitely installed
Open up Terminal · Type open .bash_profile · In the text file that pops up, add this line at the end: export PYTHONPATH=$PYTHONPATH:/System/ ......
Read more >
ERROR in @aws-sdk/util-endpoints · Issue #4067
Should not import the named export 'partitions' (imported as 'partitions') from default-exporting module (only default export is available soon).
Read more >
I am facing build error
Am facing the below error Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile (default-compile) on project.
Read more >
Export-ModuleMember (Microsoft.PowerShell.Core)
This command exports only the $increment variable from the script module. No other members are exported. If you want to export a variable,...
Read more >
Azure PowerShell release notes
Learn about all of the latest updates to the Azure PowerShell modules.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found