r/PowerShell • • Feb 02 '26

Solved Please fix my stupid script.

Its a simple function that moves files from one folder to another, powershell is running in Admin because I have elevated privledges later in the script.

The problem is: If I open Powershell ISE as admin, then press F5 to run, it will error saying "MoveThem: The term 'MoveThem' is not recognized as the name of a cmdlet, function, script file, or operable program.."

Just typing: MoveThem

Function MoveThem {...}

Here is the rub: After it errors, if I press F5 again, it runs without error.

Adding a pause does nothing.

Adding a While Get Command not loaded just death spirals.

0 Upvotes

21 comments sorted by

View all comments

Show parent comment

0

u/binaryhextechdude Feb 03 '26

You know what is ridiculous? Going on about it when you have zero context. It’s not changing any time soon and certainly not because I ask for it

-2

u/Medium-Comfortable Feb 03 '26

Be a good soldier and do what you are told. πŸ˜‚