0

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

Dean Kuga
  • 11,878
  • 8
  • 54
  • 108
  • @Knuckle-Dragger no matches in the registry and I doubt it they would be storing the entire script in registry... – Dean Kuga Aug 05 '14 at 22:43

1 Answers1

2

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.

TheMadTechnician
  • 34,906
  • 3
  • 42
  • 56
  • Looks like the first line can't find the entry, I'm getting: Exception calling "Remove" with "1" argument(s): "Value cannot be null. Parameter name: item" – Dean Kuga Aug 05 '14 at 22:35
  • Well, you can always do .RemoveAt(#) and use the Index of what you are trying to remove (if it is the only thing the index is 0). When you click the AddOns menu you see an item there literally named ``? or is that a sub-selection? Or if you want to get rid of everything in the AddOns menu there's Submenus.Clear() – TheMadTechnician Aug 05 '14 at 22:53
  • No, it's in the Commands Add-On in the Modules drop-down. I posted a screen shot. – Dean Kuga Aug 05 '14 at 23:02
  • I'm sorry, I misunderstood. I don't think that's something that you can get rid of. It has built-in commands listed under in my ISE. – TheMadTechnician Aug 06 '14 at 15:27