Avatar of hypercube
hypercubeFlag for United States of America

asked on 

Powershell not acting normally

Suddenly, when using Powershell ISE, with a script in the script pane, when I click on the Run Script icon in the toolbar OR press F5, instead of the script running as usual, the Console output simply repeats the path and filename and stops with a new prompt.


Powershell

Avatar of undefined
Last Comment
hypercube
Avatar of David Johnson, CD
David Johnson, CD
Flag of Canada image

does the script start with
functrion  blah {
and end with a }

If you run this then the function is loaded into memory but not executed until you type blah from the command prompt or from after the }

i.e.
function do-something { 
write-host "This does something
}

Open in new window


If I run this I will get not output until I execute
do-something
i.e.
function do-something { 
write-host "This does something
}
do-something

Open in new window

Avatar of footech
footech
Flag of United States of America image

That sounds like normal behavior when the current tab is saved to a file.  Pressing F5 is just like entering the full path to the file for it to be run.  There won't be any other output unless the script itself produces output.

If the script is supposed to, but is not, then I would suggest closing and relaunching the ISE.
Avatar of hypercube
hypercube
Flag of United States of America image

ASKER

Than you!
Well, this isn't *new* code and I've been editing it for a while now.  This behavior just showed up.
So, it may well be some code change that was put in.
Normally, the script yields results in the console and writes to a log.  So having nothing to do shouldn't be the issue.
I don't get: "when the current tab is saved to a file".  That's never stopped execution on demand before....
ASKER CERTIFIED SOLUTION
Avatar of footech
footech
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of hypercube
hypercube
Flag of United States of America image

ASKER

Thank you both!!
Powershell
Powershell

Windows PowerShell is a task automation and configuration management framework from Microsoft, consisting of a command-line shell and associated scripting language built on the .NET Framework. PowerShell provides full access to the Component Object Model (COM) and Windows Management Instrumentation (WMI), enabling administrators to perform administrative tasks on both local and remote Windows systems as well as WS-Management and Common Information Model (CIM) enabling management of remote Linux systems and network devices.

27K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo