Dean Kuga
Dean Kuga

Reputation: 12119

How to remove <No module name> entry from PowerShell ISE

I placed some loose ps1 file in C:\Windows\System32\WindowsPowerShell\v1.0\Modules\MyFolder folder and PowerShell ISE created an entry in the Modules drop-down named <No module name> with all the variables and functions from the script.

Now although I removed the file and deleted the folder every time I start PowerShell ISE the entry is still there in the drop-down and I can't find where it is stored and how to remove it so the question is how to get rid of it?

enter image description here

Upvotes: 1

Views: 926

Answers (1)

TheMadTechnician
TheMadTechnician

Reputation: 36322

This can be modified with the $PSISE automatic variable. It takes a little digging, but here's what you want to do:

$MyEntry = $psISE.CurrentPowerShellTab.AddOnsMenu.Submenus | ?{$_.DisplayName -eq "<No module name>"}
$psISE.CurrentPowerShellTab.AddOnsMenu.Submenus.Remove($MyEntry)

That finds your listing and sets it to a variable, and then removes it.

Upvotes: 2

Related Questions