I\'m writing a PowerShell script to find out the session ID of the active user at a remote machine, to then launch a program using that session ID. Here is what I have so far.>
The regular expression (\d+)\s+Active will match the keyword "Active" preceeded by a number and the subsequent loop returns the first submatch (i.e. the number).