PowerShell disappeared or…..

Utilizing the mighty Irwin´s Operation testing in the environment I am building and administrering right now is great success. I have set up a scheduled task that runs every morning and giving me a nice report about the status of the environment and if someone have done reconfigurations or just services being down for any reason.

This week though the scheduled task started to failing.

Apparently someone had done some mistreatment to my environment path so the powershell.exe could not be found any more from CMD thus the scheduled task failing..

Screen Shot 2016-09-02 at 11.11.39

First off I could see that a %path% had snuck into, in CMD ECHO %path% shows all paths so some failure during a PS-script as in powershell %path% does not give love in the same way as the cmd console.

There could be other ways but one easy way is to find another server having the path untouched and removing the %path% from this server and adding the right way to system32 and powershell….

Screen Shot 2016-09-04 at 17.15.47

And then to correctly set the path (if you just use $env:path = $real It will only set it for the current session and not being persistent and in this case it is not enough :

Screen Shot 2016-09-04 at 17.16.32

And once that have been done I could verify that powershell was once again found within the CMD

Screen Shot 2016-09-02 at 11.17.31