Hello
I have a main script which calls other scripts and their functions.
My main script is as below:
Clear-HostSet-ExecutionPolicyUnrestricted-Force.("ChildScript.ps1")>>"Logs.log"Set-ExecutionPolicyRestricted-Force
ChildScript calls other scripts and these scripts make some changes on host (close other sessions, change local admin user name etc)
I am running this script on PowerShell ISE (version 2). And to get user's attention, I color output of script using Write-Host.
Child scripts and their functions contain Write-Host, Read-Host, Write-Error functions and some variables (as $ServiceList)
I can show some information to client(using Write-Host and Write-Error and variables as $ServiceList), get some information from client (using read-host). But I can not log to a file everything that is shown on ISE.
I tired Start/Stop Transaction , >>, Out-File, Tee-Object etc. But they didn't work.
(For transaction this link didn't worked: http://blogs.technet.com/b/heyscriptingguy/archive/2010/09/25/create-a-transcript-of-commands-from-the-windows-powershell-ise.aspx)
Do you have any suggestion to log all output of ISE to a file?
Thanks