title: Variables I listed to export in my powershell module manifest aren't actually exporting
body: <p>I am creating a script module and using a manifest to export script members and set other module properties. I have followed just about every example manifest I've found and even used New-ModuleManifest to create a baseline manifest with the properties I want, I still cannot get the variables I want to export to actually export.</p>
  
  <p>The intention here is to do all declarations in the manifest without having to use <code>Export-ModuleMember</code> in the module script.</p>
  
  <p>Here is the script module:</p>
  
  <pre><code>#
  # Widget.psm1
  #
  
  [System.Random]$rGen = New-Object System.Random;
  [string]$WidgetBaseName = $null;
  [string]$WidgetColor = "Blue";
  
  function Get-WidgetName
  {
      param
      (
          [Parameter(Mandatory=$true)]
          [string]$widgetName,
          [switch]$appendRandomNumber
      )
  
      if (![string]::IsNullOrEmpty($WidgetBaseName))
      {
          $widgetName = $WidgetBaseName + $widgetName;
      }
  
      if ($appendRandomNumber)
      {
          return [string]::Format("{0}{1:D4}", $widgetName, $rGen.Next(10000));
      }
      else
      {
          return $widgetName;
      }
  }
  
  function Get-WidgetBlessing()
  {
      return [string]::Format("A thousand blessings upon your {0} widget!", $WidgetColor);
  }
  </code></pre>
  
  <p>And this is the manifest:</p>
  
  <pre><code>#
  # Widget.psd1
  #
  
  @{
  
  # Script module or binary module file associated with this manifest
  RootModule = 'Widget.psm1'
  
  # Version number of this module.
  ModuleVersion = '0.0.0.1'
  
  # ID used to uniquely identify this module
  GUID = 'c4437164-ea47-4148-97ed-48737bd5824d'
  
  # Author of this module
  Author = 'Widget Developer'
  
  # Company or vendor of this module
  CompanyName = 'Fictional Company Inc.'
  
  # Copyright statement for this module
  Copyright = '(c) 2016 Fictional Company. All rights reserved.'
  
  # Description of the functionality provided by this module
  Description = 'Widget Module'
  
  # Minimum version of the Windows PowerShell engine required by this module
  # PowerShellVersion = ''
  
  # Name of the Windows PowerShell host required by this module
  # PowerShellHostName = ''
  
  # Minimum version of the Windows PowerShell host required by this module
  # PowerShellHostVersion = ''
  
  # Minimum version of the .NET Framework required by this module
  # DotNetFrameworkVersion = ''
  
  # Minimum version of the common language runtime (CLR) required by this module
  # CLRVersion = ''
  
  # Processor architecture (None, X86, Amd64) required by this module
  # ProcessorArchitecture = ''
  
  # Modules that must be imported into the global environment prior to importing this module
  # RequiredModules = @()
  
  # Assemblies that must be loaded prior to importing this module
  # RequiredAssemblies = @()
  
  # Script files (.ps1) that are run in the caller's environment prior to importing this module
  # ScriptsToProcess = @()
  
  # Type files (.ps1xml) to be loaded when importing this module
  # TypesToProcess = @()
  
  # Format files (.ps1xml) to be loaded when importing this module
  # FormatsToProcess = @()
  
  # Modules to import as nested modules of the module specified in RootModule/ModuleToProcess
  # NestedModules = @()
  
  # Functions to export from this module
  FunctionsToExport = @( "Get-WidgetName", "Get-WidgetBlessing" )
  
  # Cmdlets to export from this module
  # CmdletsToExport = @()
  
  # Variables to export from this module
  VariablesToExport = 'WidgetBaseName', 'WidgetColor'
  
  # Aliases to export from this module
  AliasesToExport = '*'
  
  # List of all modules packaged with this module
  # ModuleList = @()
  
  # List of all files packaged with this module
  # FileList = @()
  
  # Private data to pass to the module specified in RootModule/ModuleToProcess
  # PrivateData = ''
  
  # HelpInfo URI of this module
  # HelpInfoURI = ''
  
  # Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix.
  # DefaultCommandPrefix = ''
  
  }
  </code></pre>
  
  <p>To check what members get exported, I run the following commands in my PowerShell window:</p>
  
  <pre><code>Import-Module Widget
  Get-Module -Name Widget | fl
  </code></pre>
  
  <p>This is the output. Note the conspicuous absence of any exported variables.</p>
  
  <pre><code>Name              : Widget
  Path              : D:\SRE\PowerShell\Widget\Widget.psm1
  Description       : Widget Module
  ModuleType        : Script
  Version           : 0.0.0.1
  NestedModules     : {}
  ExportedFunctions : {Get-WidgetBlessing, Get-WidgetName}
  ExportedCmdlets   : 
  ExportedVariables : 
  ExportedAliases   : 
  </code></pre>
  
  <p>Why is this? I'm using the manifest that New-ModuleManifest generated (<code>New-ModuleManifest -VariablesToExport WidgetBaseName WidgetColor</code>). Is that tool broken, or is there something else in the manifest that is causing this behavior?</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>I added the following line to the end of the module script:</p>
  
  <pre><code>Export-ModuleMember -Variable WidgetBaseName, WidgetColor
  </code></pre>
  
  <p>I changed the value of <code>VariablesToExport</code> to '*' in the manifest file.</p>
  
  <p>Now when I import the module and run the check as described above, I get this instead:</p>
  
  <pre><code>Name              : Widget
  Path              : D:\SRE\PowerShell\Widget\Widget.psm1
  Description       : Widget Module
  ModuleType        : Script
  Version           : 0.0.0.1
  NestedModules     : {}
  ExportedFunctions : 
  ExportedCmdlets   : 
  ExportedVariables : {WidgetBaseName, WidgetColor}
  ExportedAliases   : 
  </code></pre>
  
  <p>... where did my exported functions go?</p>