How do I add timestamps to individual lines of PowerShell & output?

You could use a filter: filter timestamp {“$(Get-Date -Format o): $_”} $result = & ping 192.168.1.1 | timestamp Sample output from $result: 2014-12-08T11:42:59.2827202-05:00: 2014-12-08T11:42:59.2857205-05:00: Pinging 192.168.1.1 with 32 bytes of data: 2014-12-08T11:43:03.1241043-05:00: Request timed out. 2014-12-08T11:43:08.1236042-05:00: Request timed out. 2014-12-08T11:43:13.1241042-05:00: Request timed out. 2014-12-08T11:43:18.1246042-05:00: Request timed out. 2014-12-08T11:43:18.1246042-05:00: 2014-12-08T11:43:18.1246042-05:00: Ping statistics for 192.168.1.1: 2014-12-08T11:43:18.1246042-05:00: Packets: … Read more

Using Process.Start() to start a process as a different user from within a Windows Service

I seem to have a working implementation (Works On My Machine(TM)) for the following scenarios: Batch File, .NET Console Assembly, .NET Windows Forms application. Here’s how: I have a windows service running as the Administrator user. I add the following policies to the Administrator user: Log on as a service Act as part of the … Read more

What does TTY mean in the unix ps command?

A TTY is a computer terminal. In the context of ps, it is the terminal that executed a particular command. The abbreviation stands for “TeleTYpewriter”, which were devices that allowed users to connect to early computers. In relation to your situation, the jar creates a virtual terminal named ‘ttys000’ but the IDE does not attach … Read more

Start a process in the same console

You shouldn’t need to do anything other than set UseShellExecute = false, as the default behaviour for the Win32 CreateProcess function is for a console application to inherit its parent’s console, unless you specify the CREATE_NEW_CONSOLE flag. I tried the following program: private static void Main() { Console.WriteLine( “Hello” ); var p = new Process(); … Read more

How to know if Process.Start() is successful?

The MSDN page on Process.Start() states that this method has an overload of type Boolean, where the return values mean: true if a process resource is started; false if no new process resource is started (for example, if an existing process is reused). Additionally it can throw three exceptions: InvalidOperationException No file name was specified … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)