When you run a powershell window in the background, how do you re-connect to it? Or instead, is it’s output intended to be viewed via log file at that point?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Normally you would just output to a log and examine that for a scheduled task. However, if you can tolerate the console window flashing up briefly, you can pinvoke to the Win32 API to control the visiblity of the console window e.g.:
Normally you wouldn’t want to show the window but perhaps you define an environment variable and then have the script inspect that environment variable for a certain value and show the window in that case e.g.
$env:DebugSchTask -eq 'yes'.