- Joined
- Jun 11, 2004
I have managed to fumble my way through powershell to read a log file based on a search name and return the last entry
the log file logs users logging on and off in this format
Logon ; 10/21/2013 1:28:31 PM ; COMPUTER_NAME ; username; ip_address
searching by username will yield the last line in the log file with that user's information.
I'd like to go one step further by launching remote assistance and inserting the computername.
I can run RA by typing "msra.exe /offerRA <device>"
so I'm thinking
How can I grab the computername from the line and put it into "something_here"?
Thanks
Code:
$a = read-host "Enter search"
get-content \\server\logon.log | where {$_ -match "$a"} | select-object -last 1
Write-Host "Press any key to close ..."
$x = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
the log file logs users logging on and off in this format
Logon ; 10/21/2013 1:28:31 PM ; COMPUTER_NAME ; username; ip_address
searching by username will yield the last line in the log file with that user's information.
I'd like to go one step further by launching remote assistance and inserting the computername.
I can run RA by typing "msra.exe /offerRA <device>"
so I'm thinking
Code:
$a = read-host "Enter search"
get-content \\server\logon.log | where {$_ -match "$a"} | select-object -last 1
Write-Host "Press any key to close ..."
Start-Process msra.exe /offerRA something_here
$x = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
How can I grab the computername from the line and put it into "something_here"?
Thanks
Last edited: