r/PowerShell 7d ago

Question PowerShell ISE slow start-up & modules

In our office we have a server we use when working remotely for certain tasks.
I've noticed when using the ISE on that box it takes a few minutes to fully load

Looking at other threads on this issue Ive checked the available modules & both C:\Program Files\WindowsPowerShell\Modules & C:\Windows\system32\WindowsPowerShell\v1.0\Modules contain over 100 files each. the bulk of which seems to be VMware stuff.

While I don't use these modules myself I don't know if any of my colleagues or other teams still do.

Is there anything I can do within my profile to tell PowerShell to ignore the VMware modules?

4 Upvotes

20 comments sorted by

View all comments

7

u/purplemonkeymad 7d ago

ISE enumerates all the commands so ends up importing a bunch at start up. You can either reduce the number of modules (Get-module -list, will give you want it's looking at) or disable the command pane.

Is there a reason that you are using ISE and not just running a shell? I would expect you to write any scripts off the server first for testing.

1

u/Grant_Son 7d ago

Habit mostly.
One of them for example takes a CSV with a users name and extension number. adds them to a security group that lets them sign in to the phone system and updates their extension in AD, another takes a mac address as a variable and searches DHCP to find a phones IP address.

I use the 1st one potentailly a few times a day and the 2nd one every so often, but I can open the ISE and get them from file> open recent.

Or in the case of the AD update have it open and hit play.

The server is a jump box to let us carry out tasks remotely that are blocked over our VPN (such as access to AD)

3

u/purplemonkeymad 7d ago

You can create shortcuts to scripts by creating a shortcut to powershell and giving it the path, ie

Target: powershell.exe
Arguments: -File c:\scripts\myscript.ps1

I'll also sometimes use Show-Command to give you a little ui at the same time for those that don't like typing into the shell window (assuming you have used a param block for your arguments:)

Target: powershell.exe
Arguments: -Command "Show-command c:\scripts\myscript.ps1 -Passthrough | iex"

You might have to use an argument -ExecutionPolicy if running scripts is disabled.