The Update-ModuleManifest lets you programmatically update settings, but how do I programmatically reset a setting as RequiredModules
back to its original setting ("no required modules"):
# RequiredModules = @()
Tried:
Update-ModuleManifest .\Test\Test.psd1 -RequiredModules @()
Update-ModuleManifest: Cannot validate argument on parameter 'RequiredModules'. The argument is null, empty, or an element of the argument collection contains a null value. Supply a collection that does not contain any null values and then try the command again.
Update-ModuleManifest .\Test\Test.psd1 -RequiredModules ''
Update-ModuleManifest: Cannot validate argument on parameter 'RequiredModules'. The argument is null, empty, or an element of the argument collection contains a null value. Supply a collection that does not contain any null values and then try the command again.
Update-ModuleManifest .\Test\Test.psd1 -RequiredModules $Null
Update-ModuleManifest: Cannot validate argument on parameter 'RequiredModules'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again.
It appears that the new PSResourceGet module contains a newer version of the Update-ModuleManifest
cmdlet with a slightly different name Update-PSModuleManifest (1.0.6
).
This version works as expected:
Install-Module -Name Microsoft.PowerShell.PSResourceGet -RequiredVersion 1.0.6
Update-PSModuleManifest -Path .\Tests.psd1 -NestedModules @()