r/PowerShell • u/Level-Impression • Jul 04 '18
Solved Why does my powershell script stop immediantely after being opened...?
New thread is here: https://www.reddit.com/r/PowerShell/comments/8wceh3/why_does_my_script_work_in_iseps_command_but_not/
It used to work but now it suddently terminates less than a second after being opened. I set the execution policy to unrestricted & re-installed Windows yet it still does not work...
The powershell shows up for 1 second in task manager before windows security health service when it's run using .vbs & then disappears: https://i.imgur.com/VNX7NKx.png
When I paste the script code into PowerShell ISE it works, why is this?
Just to clarify a few things:
The .ps1 file worked with task scheduler (it would load a console window before the message showing up) & when I clicked on the .ps1 file it would also load a console window before the message showed up. When I moved to VB it worked when I clicked on the VB file & when I used the VB file with task scheduler; both without the console window popping up before the message showed.
It still works with VB but only if I create a new user account then after like a day or two it stops working...
Here's what the properties of the task look like (when it worked): https://i.imgur.com/bBIS3od.png
1
u/Lee_Dailey [grin] Jul 05 '18 edited Jul 05 '18
howdy Level-Impression,
oooo! that looks like it may have some impact. [grin]
if you are not running this on a personal system, i would talk to your admin folks about recent changes. especially security & group policy stuff.
if this is a personal system, then i would start checking for recent windows updates. MS has taken the nasty step of changing things with very little warning - especially when dealing with non-enterprise setups. [sigh ...]
i use win7 on a single rather old system at home. i've no access at all to anything else. that means i am not going to be much use going forward on this. [sigh ...]
take care,
lee